c++: non-static member, decltype, {} [PR100205]
authorJason Merrill <jason@redhat.com>
Tue, 18 May 2021 16:18:56 +0000 (12:18 -0400)
committerJason Merrill <jason@redhat.com>
Tue, 18 May 2021 19:44:24 +0000 (15:44 -0400)
This test was fixed by my second patch for PR93314, which distinguishes
between constant-expression and potentially-constant-evaluated contexts in a
way that my first patch did not.

PR c++/100205
PR c++/99314

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/decltype-nonstatic1.C: New test.

gcc/testsuite/g++.dg/cpp0x/decltype-nonstatic1.C [new file with mode: 0644]

diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype-nonstatic1.C b/gcc/testsuite/g++.dg/cpp0x/decltype-nonstatic1.C
new file mode 100644 (file)
index 0000000..bc488ff
--- /dev/null
@@ -0,0 +1,16 @@
+// PR c++/100205
+// { dg-do compile { target c++11 } }
+
+struct coordinate_matrix {
+  using index_t = unsigned;
+  struct convert_to_matrix_coordinate {
+    index_t column_id;
+  };
+  index_t column_id;
+
+  // does not work
+  using value_type2 = decltype(convert_to_matrix_coordinate{column_id});
+
+  // does work
+  using value_type5 = decltype(column_id);
+};