re PR c++/78649 (ICE on invalid C++ code on x86_64-linux-gnu (internal compiler error...
authorJakub Jelinek <jakub@redhat.com>
Fri, 2 Dec 2016 21:23:22 +0000 (22:23 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 2 Dec 2016 21:23:22 +0000 (22:23 +0100)
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: r243204

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

index d39c222d16a3ea807e492c2de4425ff152f53d07..f16813d1be025a4450de3547a63eef30cc5a6da8 100644 (file)
@@ -1,3 +1,9 @@
+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-12-02  Cesar Philippidis  <cesar@codesourcery.com>
            James Norris  <jnorris@codesourcery.com>
 
index 8b0a21cb2b2ff64ba7f1c5c002d1eefc71d7decb..b51e5801109c9d16cd581aae03ae5da75e7dd895 100644 (file)
@@ -14082,7 +14082,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 261731c54b0d5b9a9dccab96d0d79dea3221a0a9..103906be84ea39be54188974b99252c956897d1d 100644 (file)
@@ -1,3 +1,8 @@
+2016-12-02  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/78649
+       * g++.dg/cpp0x/pr78649.C: New test.
+
 2016-12-02  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/70322
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> ();
+}