3 struct A { int const i; };
8 class is_constructible_via_new_without_initializer
10 template<int> class size {};
12 typedef char yes_type;
13 struct no_type { char data[2]; };
16 static yes_type sfinae (size< sizeof (new U) >*);
19 static no_type sfinae (...);
22 static const bool value = sizeof (sfinae<T>(0)) == sizeof (yes_type);
25 #define JOIN( X, Y ) DO_JOIN( X, Y )
26 #define DO_JOIN( X, Y ) DO_JOIN2(X,Y)
27 #define DO_JOIN2( X, Y ) X##Y
29 #ifdef __GXX_EXPERIMENTAL_CXX0X__
30 # define STATIC_ASSERT(Expr) static_assert(Expr, #Expr)
32 # define STATIC_ASSERT(Expr) int JOIN(a,__LINE__)[Expr? 1 : -1]
35 STATIC_ASSERT (!is_constructible_via_new_without_initializer<A>::value);
36 STATIC_ASSERT (!is_constructible_via_new_without_initializer<B>::value);
37 STATIC_ASSERT (is_constructible_via_new_without_initializer<C>::value);