aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr7.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr7.C')
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr7.C20
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr7.C b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr7.C
new file mode 100644
index 0000000..93f9141
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr7.C
@@ -0,0 +1,20 @@
+// PR c++/49290
+// { dg-do compile { target c++11 } }
+
+typedef unsigned T;
+struct S
+{
+ constexpr T foo (void);
+ unsigned s1[16];
+};
+
+constexpr T
+S::foo ()
+{
+ return *(T *) (s1 + 10);
+}
+
+constexpr S s = { 0,1,2,3,4,5,6,7,8,9,10 };
+
+#define SA(X) static_assert ((X), #X)
+SA(s.foo() == 10);