re PR c++/85076 (ICE with invalid template used as lambda argument)
authorJakub Jelinek <jakub@redhat.com>
Tue, 27 Mar 2018 19:58:30 +0000 (21:58 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 27 Mar 2018 19:58:30 +0000 (21:58 +0200)
PR c++/85076
* tree.c (cp_build_reference_type): If to_type is error_mark_node,
return it right away.

* g++.dg/cpp1y/pr85076.C: New test.

From-SVN: r258901

gcc/cp/ChangeLog
gcc/cp/tree.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp1y/pr85076.C [new file with mode: 0644]

index f7f48879b6f7fdd916d49208bb2c55648f6bdf4b..b410f3d003e4473c248aec1ea86919db1699e281 100644 (file)
@@ -1,3 +1,9 @@
+2018-03-27  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/85076
+       * tree.c (cp_build_reference_type): If to_type is error_mark_node,
+       return it right away.
+
 2018-03-27  Volker Reichelt  <v.reichelt@netcologne.de>
 
        * search.c (check_final_overrider): Use inform instead of error
index f1a90bdec0fc4639957b259658276a6293cc0687..0355b9ed9c59baf8e17d2dc741d5cf48a6371a3f 100644 (file)
@@ -1078,6 +1078,9 @@ cp_build_reference_type (tree to_type, bool rval)
 {
   tree lvalue_ref, t;
 
+  if (to_type == error_mark_node)
+    return error_mark_node;
+
   if (TREE_CODE (to_type) == REFERENCE_TYPE)
     {
       rval = rval && TYPE_REF_IS_RVALUE (to_type);
index b8d56f8532c6f46f1f7bf70f7f0c1506ef969e85..9cd81d9946bcb794c948f249d7bb1b198954c990 100644 (file)
@@ -1,3 +1,8 @@
+2018-03-27  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/85076
+       * g++.dg/cpp1y/pr85076.C: New test.
+
 2018-03-27  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        PR fortran/85084
diff --git a/gcc/testsuite/g++.dg/cpp1y/pr85076.C b/gcc/testsuite/g++.dg/cpp1y/pr85076.C
new file mode 100644 (file)
index 0000000..6d54dea
--- /dev/null
@@ -0,0 +1,6 @@
+// PR c++/85076
+// { dg-do compile { target c++14 } }
+
+template<typename> struct A*;  // { dg-error "expected unqualified-id before" }
+
+auto a = [](A<auto>) {};       // { dg-error "is not a template|has incomplete type" }