Browse Source
C compilers can have GNU extensions to support typeof in C code, but some C++ compilers like clang are removing the builtin since decltype can be used in C++ without the constraints from typeof. Decltype is not 100% equivalent for this reason: references will be kept in the returned type. The check in m4/typeof.m4 comes from graydon/monotone and dovecot/core and was slightly modified to namespace the define for C++ code.
2 changed files with 23 additions and 0 deletions
@ -0,0 +1,20 @@ |
|||
dnl @synopsis AX_CXX_TYPEOF |
|||
dnl |
|||
dnl tests for the presence of the gcc hashmap stl extension |
|||
dnl |
|||
dnl @author Patrick Mauritz <oxygene@studentenbude.ath.cx> |
|||
dnl @version 2005-08-15 |
|||
dnl @license AllPermissive |
|||
|
|||
AC_DEFUN([AX_CXX_TYPEOF],[ |
|||
AC_LANG_ASSERT([C++]) |
|||
AC_CACHE_CHECK(whether the C++ compiler supports typeof, |
|||
ac_cv_cxx_typeof, |
|||
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ int x; typeof (x) y[6]; ]])], |
|||
[ac_cv_cxx_typeof=yes], |
|||
[ac_cv_cxx_typeof=no]) |
|||
]) |
|||
if test "$ac_cv_cxx_typeof" = yes; then |
|||
AC_DEFINE(HAVE_CXX_TYPEOF, 1, [Define if the compiler supports typeof.]) |
|||
fi |
|||
]) |
|||
Loading…
Reference in new issue