aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/expr/sizeof2.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/g++.dg/expr/sizeof2.C')
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/expr/sizeof2.C30
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/expr/sizeof2.C b/gcc-4.9/gcc/testsuite/g++.dg/expr/sizeof2.C
new file mode 100644
index 000000000..ca14ff79f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/expr/sizeof2.C
@@ -0,0 +1,30 @@
+// { dg-do compile }
+// Contributed by Wolfgang Bangerth <bangerth at ticam dot utexas dot edu>
+// PR c++/9259: Allow non-qualified member calls in sizeof expressions.
+
+template <bool> struct StaticAssert;
+template <> struct StaticAssert<true> {};
+
+struct S
+{
+ static int check ();
+ static double check2 ();
+ static const int value = sizeof(check());
+ static const int value2 = sizeof(check2());
+};
+
+template <class>
+struct T
+{
+ static int check ();
+ static double check2 ();
+ static const int value = sizeof(check());
+ static const int value2 = sizeof(check2());
+};
+
+StaticAssert<(S::value == sizeof(int))> s;
+StaticAssert<(S::value2 == sizeof(double))> s2;
+
+StaticAssert<(T<void>::value == sizeof(int))> t;
+StaticAssert<(T<void>::value2 == sizeof(double))> t2;
+