summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/constexpr-static3.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp0x/constexpr-static3.C')
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-static3.C18
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-static3.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-static3.C
new file mode 100644
index 000000000..dccdc854b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-static3.C
@@ -0,0 +1,18 @@
+// Test for constant initialization of class with vtable
+// { dg-options "-std=c++0x -save-temps" }
+// { dg-final { scan-assembler-not "static_initialization" } }
+// { dg-final cleanup-saved-temps }
+// { dg-do run }
+
+int r = 1;
+// implicit default constructor for A and B is constexpr
+struct A { virtual void f() {} };
+struct B: A { virtual void f() { r = 0; } };
+
+B b;
+
+int main()
+{
+ b.f();
+ return r;
+}