]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR c++/78649 (ICE on invalid C++ code on x86_64-linux-gnu (internal...
authorJakub Jelinek <jakub@redhat.com>
Tue, 30 May 2017 07:46:27 +0000 (09:46 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 30 May 2017 07:46:27 +0000 (09:46 +0200)
Backported from mainline
2016-12-02  Jakub Jelinek  <jakub@redhat.com>

PR c++/78649
* pt.c (tsubst_init): Don't call build_value_init if decl's type
is error_mark_node.

* g++.dg/cpp0x/pr78649.C: New test.

From-SVN: r248630

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/pr78649.C [new file with mode: 0644]

index 75be7eae019c6b7802cd8334019f16cd09123898..b0fbf05a999669a5215d9fc88e0c15cda6fc52d8 100644 (file)
@@ -1,6 +1,12 @@
 2017-05-30  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2016-12-02  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/78649
+       * pt.c (tsubst_init): Don't call build_value_init if decl's type
+       is error_mark_node.
+
        2016-11-23  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/77739
index 578fa20184bdf19a990e620194ba94138f0295d8..a19cc0c46a9cd8f52d9e36f4b3712ad3f508282c 100644 (file)
@@ -12988,7 +12988,7 @@ tsubst_init (tree init, tree decl, tree args,
 
   init = tsubst_expr (init, args, complain, in_decl, false);
 
-  if (!init)
+  if (!init && TREE_TYPE (decl) != error_mark_node)
     {
       /* If we had an initializer but it
         instantiated to nothing,
index 780d457a30c293559ff0355a0b12c1e802dda071..303b4ab4025497a9df1bf092e2aab5b4d1c1a1d4 100644 (file)
@@ -1,6 +1,11 @@
 2017-05-30  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2016-12-02  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/78649
+       * g++.dg/cpp0x/pr78649.C: New test.
+
        2016-11-28  Jakub Jelinek  <jakub@redhat.com>
 
        PR fortran/78298
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr78649.C b/gcc/testsuite/g++.dg/cpp0x/pr78649.C
new file mode 100644 (file)
index 0000000..43bcb64
--- /dev/null
@@ -0,0 +1,16 @@
+// PR c++/78649
+// { dg-do compile { target c++11 } }
+
+template <class> void foo ();
+template <class T, class... U>
+void
+test ()
+{
+  T t (foo<U>...);     // { dg-error "declared void" }
+}
+
+int
+main ()
+{
+  test<void> ();
+}