Merge from mainline (167278:168000).
[official-gcc/graphite-test-results.git] / gcc / testsuite / g++.dg / template / sfinae27.C
blob0ecd1700dec8b12cdfc6dc34faab65b0c7cc302e
1 // Origin: PR c++/46162
3 struct small_type { char dummy; };
4 struct large_type { char dummy[2]; };
6 template<class T>
7 struct has_foo_member_variable
9   template<int T::*> struct tester;
10   template<class U> static small_type has_foo(tester<&U::foo> *);
11   template<class U> static large_type has_foo(...);
12   static const bool value = (sizeof(has_foo<T>(0)) == sizeof(small_type));
15 struct A
17   static int foo()
18   {
19     return 0;
20   }
23 struct B
25   static int foo;
28 void
29 bar()
31   bool b = has_foo_member_variable<A>::value;