From 7299275f74a31f7f3774ade89c7447fc6fb7cf98 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 2 Mar 2018 18:07:39 +0100 Subject: [PATCH] re PR c++/84662 (internal compiler error: tree check: expected class 'type', have 'exceptional' (error_mark) in is_bitfield_expr_with_lowered_type, at cp/typeck.c:1944) PR c++/84662 * pt.c (tsubst_copy_and_build) : Use RETURN instead of return. : Likewise. : 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 | 9 +++++++++ gcc/cp/pt.c | 8 +++++--- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/cpp1y/pr84662.C | 6 ++++++ 4 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp1y/pr84662.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9986b88489a..79e0d8f60dc 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +2018-03-02 Jakub Jelinek + + PR c++/84662 + * pt.c (tsubst_copy_and_build) : Use + RETURN instead of return. + : Likewise. + : If op0 is error_mark_node, just return + it instead of wrapping it into CONVERT_EXPR. + 2018-03-02 Jason Merrill Fix MIPS16 ICE. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index f67080fc279..c81bd5094d9 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -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: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3864204337d..0c73e80a6ff 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-03-02 Jakub Jelinek + + PR c++/84662 + * g++.dg/cpp1y/pr84662.C: New test. + 2018-03-02 Thomas Schwinge * 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 index 00000000000..36bd201073e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/pr84662.C @@ -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" } -- 2.30.2