re PR c++/79629 (ICE on invalid code in tsubst_copy, at cp/pt.c:14477)
authorMarek Polacek <polacek@redhat.com>
Sat, 1 Dec 2018 21:32:16 +0000 (21:32 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Sat, 1 Dec 2018 21:32:16 +0000 (21:32 +0000)
PR c++/79629
* g++.dg/other/error35.C: New test.

From-SVN: r266712

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/other/error35.C [new file with mode: 0644]

index c7afb2b71c2a648da0eb332cfc8146e07cf3c246..9dfc58d4d68d6d7e32e076009611b45a8614bfcd 100644 (file)
@@ -37,6 +37,9 @@
        PR c++/83856
        * g++.dg/cpp1y/lambda-generic-83856.C: New test.
 
+       PR c++/79629
+       * g++.dg/other/error35.C: New test.
+
 2018-12-01  Jeff Law  <law@redhat.com>
 
        * gcc.dg/predict-22.c: Update expected output.
diff --git a/gcc/testsuite/g++.dg/other/error35.C b/gcc/testsuite/g++.dg/other/error35.C
new file mode 100644 (file)
index 0000000..e9c8371
--- /dev/null
@@ -0,0 +1,14 @@
+// PR c++/79629
+// { dg-do compile { target c++14 } }
+// { dg-options "-w" }
+
+template <typename> struct S {
+  enum E : int;
+  constexpr int g() const;
+};
+enum S<char>::E;
+template <typename T> enum S<T>::E : int { b };
+template <typename T>
+constexpr int S<T>::g() const { b; } // { dg-error "not declared" }
+static_assert(S<char>().g() == 1, ""); // { dg-error "" }
+// { dg-message "in .constexpr. expansion of" "" { target *-*-* } .-1 }