re PR c++/59937 ([constexpr] bogus diagnostic "used in its own initializer")
authorPaolo Carlini <paolo.carlini@oracle.com>
Tue, 20 Jan 2015 13:39:10 +0000 (13:39 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Tue, 20 Jan 2015 13:39:10 +0000 (13:39 +0000)
2015-01-20  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/59937
* g++.dg/cpp0x/constexpr-59937-1.C: New.
* g++.dg/cpp0x/constexpr-59937-2.C: Likewise.

From-SVN: r219894

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

index 1049e672c0fa7ed8ca9179b43284068919cc45b2..4d45666b0e0d5664cad7f42cfcc3c57f6ed781ea 100644 (file)
@@ -1,3 +1,9 @@
+2015-01-20  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/59937
+       * g++.dg/cpp0x/constexpr-59937-1.C: New.
+       * g++.dg/cpp0x/constexpr-59937-2.C: Likewise.
+
 2015-01-20  Richard Biener  <rguenther@suse.de>
 
        PR ipa/64684
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-59937-1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-59937-1.C
new file mode 100644 (file)
index 0000000..d9fbd33
--- /dev/null
@@ -0,0 +1,5 @@
+// PR c++/59937
+// { dg-do compile { target c++11 } }
+
+constexpr const char * const &r = "";
+constexpr const char * const &s = r;
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-59937-2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-59937-2.C
new file mode 100644 (file)
index 0000000..e67d946
--- /dev/null
@@ -0,0 +1,12 @@
+// PR c++/59937
+// { dg-do compile { target c++11 } }
+
+template<typename T> constexpr bool truth(const T&) { return true; }
+
+template<typename T>
+void test()
+{
+  int i[1];
+  constexpr bool untrue = !truth(i);
+  static_assert(!untrue, "");
+}