Vadim Zhukov wrote:
> While working on getting Boost & its friends work under Clang,
> I've stumbled upon the code that looks like the following:
> 
>    decltype(x, y) z = w;

why not espie's fix from earlier?

>>>>

but clang++ has variadic macros, like C99... the following patch allows
macro decltype()  to work a lot more like builtin __decltype in pre-C++11

(note that still works with -std=c++98 -pedantic, much to my surprise, but
which is cool)

Index: __config
===================================================================
RCS file: /cvs/src/lib/libcxx/include/__config,v
retrieving revision 1.3
diff -u -p -r1.3 __config
--- __config    19 Sep 2016 22:17:22 -0000      1.3
+++ __config    5 May 2017 15:21:58 -0000
@@ -670,7 +670,7 @@ template <unsigned> struct __static_asse
 #ifdef _LIBCPP_HAS_NO_DECLTYPE
 // GCC 4.6 provides __decltype in all standard modes.
 #if !__is_identifier(__decltype) || _GNUC_VER >= 406
-#  define decltype(__x) __decltype(__x)
+#  define decltype(__x, ...) __decltype(__x, ##__VA_ARGS__)
 #else
 #  define decltype(__x) __typeof__(__x)
 #endif

Reply via email to