2018-10-23 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / g++.dg / expr / sizeof2.C
blobca14ff79f72e1d64a643a18a53892a5ba8790816
1 // { dg-do compile }
2 // Contributed by Wolfgang Bangerth <bangerth at ticam dot utexas dot edu>
3 // PR c++/9259: Allow non-qualified member calls in sizeof expressions.
5 template <bool> struct StaticAssert;
6 template <> struct StaticAssert<true> {};
8 struct S 
10   static int check ();
11   static double check2 ();
12   static const int value = sizeof(check());
13   static const int value2 = sizeof(check2());
16 template <class>
17 struct T
19   static int check ();
20   static double check2 ();
21   static const int value = sizeof(check());
22   static const int value2 = sizeof(check2());
25 StaticAssert<(S::value == sizeof(int))> s;
26 StaticAssert<(S::value2 == sizeof(double))> s2;
28 StaticAssert<(T<void>::value == sizeof(int))> t;
29 StaticAssert<(T<void>::value2 == sizeof(double))> t2;