Debian Codegraph @

gcc/testsuite/g++.dg/expr/sizeof2.C

raw
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.
4
5 template <bool> struct StaticAssert;
6 template <> struct StaticAssert<true> {};
7
8 struct S
9 {
10 static int check ();
11 static double check2 ();
12 static const int value = sizeof(check());
13 static const int value2 = sizeof(check2());
14 };
15
16 template <class>
17 struct T
18 {
19 static int check ();
20 static double check2 ();
21 static const int value = sizeof(check());
22 static const int value2 = sizeof(check2());
23 };
24
25 StaticAssert<(S::value == sizeof(int))> s;
26 StaticAssert<(S::value2 == sizeof(double))> s2;
27
28 StaticAssert<(T<void>::value == sizeof(int))> t;
29 StaticAssert<(T<void>::value2 == sizeof(double))> t2;
30