* decl.c (make_typename_type): s/parameters/arguments/.
[official-gcc.git] / gcc / testsuite / g++.dg / cpp0x / sfinae45.C
blobbd375145fea3de2266df46b28a1457afec62542d
1 // PR c++/56970
2 // { dg-do compile { target c++11 } }
4 template <typename T>
5 struct has
7   template <typename>
8   constexpr static int test(...) {
9     return 0;
10   }
11   
12   template <typename C>
13   constexpr static int test(decltype(sizeof(C::x))) {  // Doesn't compile.
14     return 1;   // Is a member variable.
15   }
16   
17   template <typename C, int c = sizeof(decltype(((C*)nullptr)->x()))>
18   constexpr static int test(int) {
19     return 2;   // Is a member function.
20   }
22   static const int value = test<T>(0);
25 struct foo {
26   int x;
29 struct bar {
30   int x();
33 static_assert(has<int>::value == 0, "");
34 static_assert(has<foo>::value == 1, "");
35 static_assert(has<bar>::value == 2, "");