]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/84662 (internal compiler error: tree check: expected class 'type', have...
authorJakub Jelinek <jakub@redhat.com>
Fri, 2 Mar 2018 17:07:39 +0000 (18:07 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 2 Mar 2018 17:07:39 +0000 (18:07 +0100)
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: r258146

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

index 9986b88489a138144e2ccfb477ecf3bfe43a4faf..79e0d8f60dc38b5bc8e454ca4a345d324facd46d 100644 (file)
@@ -1,3 +1,12 @@
+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-03-02  Jason Merrill  <jason@redhat.com>
 
        Fix MIPS16 ICE.
index f67080fc2793d251a8bc0d07ac334ab5fdb771f5..c81bd5094d95dd693a74bb8ddacb8bec8b2df6f6 100644 (file)
@@ -17318,14 +17318,14 @@ 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 (TREE_CODE (templ) == SCOPE_REF)
          {
            tree name = TREE_OPERAND (templ, 1);
            tree tid = lookup_template_function (name, targs);
            TREE_OPERAND (templ, 1) = tid;
-           return templ;
+           RETURN (templ);
          }
 
        if (variable_template_p (templ))
@@ -17401,6 +17401,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));
       }
 
@@ -17549,7 +17551,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:
index 3864204337d444a7bf88ad87aaadc16f4884b0eb..0c73e80a6ff23d584babe5acc58dc439ee781b67 100644 (file)
@@ -1,3 +1,8 @@
+2018-03-02  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/84662
+       * g++.dg/cpp1y/pr84662.C: New test.
+
 2018-03-02  Thomas Schwinge  <thomas@codesourcery.com>
 
        * g++.dg/lto/20080915_0.C: Don't use "dg-lto-options".
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" }