annotate gcc/testsuite/g++.dg/init/pr25811-4.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 // { dg-do compile }
kono
parents:
diff changeset
2 // { dg-options "-fpermissive" }
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4 struct A { int const i; };
kono
parents:
diff changeset
5 struct B { int& i; };
kono
parents:
diff changeset
6 struct C { int i; };
kono
parents:
diff changeset
7
kono
parents:
diff changeset
8 template< class T >
kono
parents:
diff changeset
9 class is_constructible_via_new_without_initializer
kono
parents:
diff changeset
10 {
kono
parents:
diff changeset
11 template<int> class size {};
kono
parents:
diff changeset
12
kono
parents:
diff changeset
13 typedef char yes_type;
kono
parents:
diff changeset
14 struct no_type { char data[2]; };
kono
parents:
diff changeset
15
kono
parents:
diff changeset
16 template <class U>
kono
parents:
diff changeset
17 static yes_type sfinae (size< sizeof (new U) >*);
kono
parents:
diff changeset
18
kono
parents:
diff changeset
19 template <class U>
kono
parents:
diff changeset
20 static no_type sfinae (...);
kono
parents:
diff changeset
21
kono
parents:
diff changeset
22 public:
kono
parents:
diff changeset
23 static const bool value = sizeof (sfinae<T>(0)) == sizeof (yes_type);
kono
parents:
diff changeset
24 };
kono
parents:
diff changeset
25
kono
parents:
diff changeset
26 #define JOIN( X, Y ) DO_JOIN( X, Y )
kono
parents:
diff changeset
27 #define DO_JOIN( X, Y ) DO_JOIN2(X,Y)
kono
parents:
diff changeset
28 #define DO_JOIN2( X, Y ) X##Y
kono
parents:
diff changeset
29
kono
parents:
diff changeset
30 #ifdef __GXX_EXPERIMENTAL_CXX0X__
kono
parents:
diff changeset
31 # define STATIC_ASSERT(Expr) static_assert(Expr, #Expr)
kono
parents:
diff changeset
32 #else
kono
parents:
diff changeset
33 # define STATIC_ASSERT(Expr) int JOIN(a,__LINE__)[Expr? 1 : -1]
kono
parents:
diff changeset
34 #endif
kono
parents:
diff changeset
35
kono
parents:
diff changeset
36 STATIC_ASSERT (!is_constructible_via_new_without_initializer<A>::value);
kono
parents:
diff changeset
37 STATIC_ASSERT (!is_constructible_via_new_without_initializer<B>::value);
kono
parents:
diff changeset
38 STATIC_ASSERT (is_constructible_via_new_without_initializer<C>::value);