re PR c++/77304 (ICE on C++ code with invalid template parameter: in gimplify_expr...
authorMarek Polacek <polacek@redhat.com>
Wed, 13 Feb 2019 16:35:44 +0000 (16:35 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Wed, 13 Feb 2019 16:35:44 +0000 (16:35 +0000)
PR c++/77304
* g++.dg/cpp2a/nontype-class13.C: New test.

From-SVN: r268849

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

index f1a8295..bda30c8 100644 (file)
@@ -1,3 +1,8 @@
+2019-02-13  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/77304
+       * g++.dg/cpp2a/nontype-class13.C: New test.
+
 2019-02-13  Wilco Dijkstra  <wdijkstr@arm.com>
 
        PR target/89190
diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-class13.C b/gcc/testsuite/g++.dg/cpp2a/nontype-class13.C
new file mode 100644 (file)
index 0000000..14c601b
--- /dev/null
@@ -0,0 +1,21 @@
+// PR c++/77304
+// { dg-do compile { target c++2a } }
+
+struct S {};
+
+template < typename T > struct A
+{
+  template < S > void f () {}
+
+  static void * g ()
+  {
+    return (void *) f < a >; // { dg-error "invalid" }
+  }
+
+  static S a;
+};
+
+void * f ()
+{
+  return A < int >::g ();
+}