]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR c++/84662 (internal compiler error: tree check: expected class 'type...
authorJakub Jelinek <jakub@redhat.com>
Mon, 25 Jun 2018 17:26:53 +0000 (19:26 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 25 Jun 2018 17:26:53 +0000 (19:26 +0200)
Backported from mainline
2018-03-02  Jakub Jelinek  <jakub@redhat.com>

PR c++/84662
* pt.c (tsubst_copy_and_build) <case TEMPLATE_ID_EXPR>: Use
RETURN instead of return.
<case POINTER_PLUS_EXPR>: Likewise.
<case CONVERT_EXPR>: If op0 is error_mark_node, just return
it instead of wrapping it into CONVERT_EXPR.

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

From-SVN: r262069

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

index 3697ff7e990745820db47381941a2ea380745da3..2748e4df84766aa4e4bfdcc740a8db590013926f 100644 (file)
@@ -1,6 +1,15 @@
 2018-06-25  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2018-03-02  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/84662
+       * pt.c (tsubst_copy_and_build) <case TEMPLATE_ID_EXPR>: Use
+       RETURN instead of return.
+       <case POINTER_PLUS_EXPR>: Likewise.
+       <case CONVERT_EXPR>: If op0 is error_mark_node, just return
+       it instead of wrapping it into CONVERT_EXPR.
+
        2018-02-26  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/84558
index 3f57c6afc689db98fbfc7a4c6147a07686a28d2e..5d32c79ac20f8940096d6ff774bce78ce3f13bf7 100644 (file)
@@ -16093,7 +16093,7 @@ tsubst_copy_and_build (tree t,
        if (targs)
          targs = tsubst_template_args (targs, args, complain, in_decl);
        if (targs == error_mark_node)
-         return error_mark_node;
+         RETURN (error_mark_node);
 
        if (variable_template_p (templ))
          RETURN (lookup_and_finish_template_variable (templ, targs, complain));
@@ -16158,6 +16158,8 @@ tsubst_copy_and_build (tree t,
       {
        tree type = tsubst (TREE_TYPE (t), args, complain, in_decl);
        tree op0 = RECUR (TREE_OPERAND (t, 0));
+       if (op0 == error_mark_node)
+         RETURN (error_mark_node);
        RETURN (build1 (CONVERT_EXPR, type, op0));
       }
 
@@ -16305,7 +16307,7 @@ tsubst_copy_and_build (tree t,
       {
        tree op0 = RECUR (TREE_OPERAND (t, 0));
        tree op1 = RECUR (TREE_OPERAND (t, 1));
-       return fold_build_pointer_plus (op0, op1);
+       RETURN (fold_build_pointer_plus (op0, op1));
       }
 
     case SCOPE_REF:
@@ -17111,7 +17113,7 @@ tsubst_copy_and_build (tree t,
             variadic capture proxy, we instantiate the elements
             when needed.  */
          gcc_assert (DECL_HAS_VALUE_EXPR_P (t));
-         return RECUR (DECL_VALUE_EXPR (t));
+         RETURN (RECUR (DECL_VALUE_EXPR (t)));
        }
       /* Fall through */
 
index df087263678672bbd2a32f709f2523b5f18eaf14..22893b53d0fae97e92d1a72e8a4ac3ed546742b9 100644 (file)
@@ -3,6 +3,9 @@
        Backported from mainline
        2018-03-02  Jakub Jelinek  <jakub@redhat.com>
 
+       PR c++/84662
+       * g++.dg/cpp1y/pr84662.C: New test.
+
        PR inline-asm/84625
        * gcc.target/i386/pr84625.c: New test.
 
diff --git a/gcc/testsuite/g++.dg/cpp1y/pr84662.C b/gcc/testsuite/g++.dg/cpp1y/pr84662.C
new file mode 100644 (file)
index 0000000..36bd201
--- /dev/null
@@ -0,0 +1,6 @@
+// PR c++/84662
+// { dg-do compile { target c++14 } }
+// { dg-options "" }
+
+double b;
+a (__attribute__((c (0 && int() - ([] {} && b) || auto))));    // { dg-error "expected constructor, destructor, or type conversion before" }