re PR c++/57694 ([c++11] constexpr constructor does not work with const address of...
authorPaolo Carlini <paolo.carlini@oracle.com>
Sun, 2 Nov 2014 09:31:12 +0000 (09:31 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Sun, 2 Nov 2014 09:31:12 +0000 (09:31 +0000)
2014-11-02  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/57694
* g++.dg/cpp0x/constexpr-ctor15.C: New.

From-SVN: r217013

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/constexpr-ctor15.C [new file with mode: 0644]

index 969a4f85edd49120c4963d103f239b50634bc49b..0cc7116266520a2468600626dedda5d554612a17 100644 (file)
@@ -1,3 +1,8 @@
+2014-11-02  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/57694
+       * g++.dg/cpp0x/constexpr-ctor15.C: New.
+
 2014-11-01  Edward Smith-Rowland  <3dw4rd@verizon.net>
 
        * g++.dg/cpp1y/feat-cxx11.C: Commentary and rearrangement of tests.
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor15.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor15.C
new file mode 100644 (file)
index 0000000..5ad278a
--- /dev/null
@@ -0,0 +1,29 @@
+// PR c++/57694
+// { dg-do compile { target c++11 } }
+
+class A
+{
+private:
+  int a;
+  const int* const aptr;
+
+public:
+  constexpr A(int _a) : a(_a), aptr(&a) { }
+};
+
+class Data { } d1;
+
+class B
+{
+private:
+  Data* dptr1;
+
+public:
+  constexpr B(Data* _p) : dptr1(_p) {}
+};
+
+class Use
+{
+  static constexpr A a{2};
+  static constexpr B b{&d1};
+};