c++: Add test for PR96268.
authorMarek Polacek <polacek@redhat.com>
Mon, 8 Mar 2021 20:26:58 +0000 (15:26 -0500)
committerMarek Polacek <polacek@redhat.com>
Mon, 8 Mar 2021 20:27:20 +0000 (15:27 -0500)
This works since the recent r11-7102, but we didn't have a test for
a template-argument context.

gcc/testsuite/ChangeLog:

PR c++/96268
* g++.dg/cpp2a/nontype-class41.C: New test.

gcc/testsuite/g++.dg/cpp2a/nontype-class41.C [new file with mode: 0644]

diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-class41.C b/gcc/testsuite/g++.dg/cpp2a/nontype-class41.C
new file mode 100644 (file)
index 0000000..2be8843
--- /dev/null
@@ -0,0 +1,13 @@
+// PR c++/96268
+// { dg-do compile { target c++20 } }
+
+template <int N>
+struct static_string { char chars[N]; /* operator<=> */ };
+
+template <int N>
+static_string(char const(&)[N]) -> static_string<N>;
+
+static_string hi = {"hi"};
+
+template <static_string str> struct name {};
+using Hi = name<{"hi"}>;