summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/constexpr-fwctor1.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp0x/constexpr-fwctor1.C')
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-fwctor1.C19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-fwctor1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-fwctor1.C
new file mode 100644
index 0000000000..d25c9c7c62
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-fwctor1.C
@@ -0,0 +1,19 @@
+// PR c++/66450
+// { dg-do compile { target c++11 } }
+
+struct foo {
+ constexpr foo(int a);
+ constexpr foo(int a, int b, int c): a{a}, b{b}, c{c} {}
+
+ int a, b, c;
+};
+
+constexpr foo make_foo(int a) { return foo{a, a+1, a+2}; }
+constexpr foo::foo(int a): foo{make_foo(a)} {}
+
+int main() {
+ constexpr const foo f{3};
+ static_assert(f.a == 3, "");
+ static_assert(f.b == 4, "");
+ static_assert(f.c == 5, "");
+}