[pushed] c++: Add test for DR 2126

Message ID 20210719141906.27978-1-polacek@redhat.com
State New
Headers show
Series
  • [pushed] c++: Add test for DR 2126
Related show

Commit Message

Lewis Hyatt via Gcc-patches July 19, 2021, 2:19 p.m.
Tested x86_64-pc-linux-gnu, applying to trunk.

	DR 2126

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/constexpr-temp2.C: New test.
---
 gcc/testsuite/g++.dg/cpp0x/constexpr-temp2.C | 6 ++++++
 1 file changed, 6 insertions(+)
 create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-temp2.C


base-commit: 8df3ee8f7d85d0708f3c3ca96b55c9230c2ae9f0
-- 
2.31.1

Patch

diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-temp2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-temp2.C
new file mode 100644
index 00000000000..28ffd2c86c4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-temp2.C
@@ -0,0 +1,6 @@ 
+// DR 2126
+// { dg-do compile { target c++11 } }
+
+typedef const int CI[3];
+constexpr CI &ci = CI{11, 22, 33};
+static_assert(ci[1] == 22, "");