From: Mikhail Maltsev Date: Sat, 20 Jun 2015 00:10:00 +0000 (+0000) Subject: re PR c++/65882 (Internal compiler error: Error reporting routines re-entered) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cd95a0d559e691d3767b238f1a584d006dcbb53e;p=gcc.git re PR c++/65882 (Internal compiler error: Error reporting routines re-entered) PR c++/65882 gcc/cp/ * call.c (build_new_op_1): Check tf_warning flag in all cases. gcc/testsuite/ * g++.dg/diagnostic/inhibit-warn-1.C: New test. * g++.dg/diagnostic/inhibit-warn-2.C: New test. From-SVN: r224702 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index eb5e4c51aa6..66564419fc0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2015-06-20 Mikhail Maltsev + + PR c++/65882 + * call.c (build_new_op_1): Check tf_warning flag in all cases. + 2015-06-19 Jason Merrill PR c++/66585 diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 5d1891d2c15..ba5da4c36da 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -5640,8 +5640,9 @@ build_new_op_1 (location_t loc, enum tree_code code, int flags, tree arg1, case TRUTH_ORIF_EXPR: case TRUTH_AND_EXPR: case TRUTH_OR_EXPR: - warn_logical_operator (loc, code, boolean_type_node, - code_orig_arg1, arg1, code_orig_arg2, arg2); + if (complain & tf_warning) + warn_logical_operator (loc, code, boolean_type_node, + code_orig_arg1, arg1, code_orig_arg2, arg2); /* Fall through. */ case GT_EXPR: case LT_EXPR: @@ -5649,8 +5650,9 @@ build_new_op_1 (location_t loc, enum tree_code code, int flags, tree arg1, case LE_EXPR: case EQ_EXPR: case NE_EXPR: - if ((code_orig_arg1 == BOOLEAN_TYPE) - ^ (code_orig_arg2 == BOOLEAN_TYPE)) + if ((complain & tf_warning) + && ((code_orig_arg1 == BOOLEAN_TYPE) + ^ (code_orig_arg2 == BOOLEAN_TYPE))) maybe_warn_bool_compare (loc, code, arg1, arg2); /* Fall through. */ case PLUS_EXPR: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 42a0ee9d335..89b859f0276 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2015-06-20 Mikhail Maltsev + + PR c++/65882 + * g++.dg/diagnostic/inhibit-warn-1.C: New test. + * g++.dg/diagnostic/inhibit-warn-2.C: New test. + 2015-06-19 Eric Botcazou * gnat.dg/specs/debug1.ads: Adjust. diff --git a/gcc/testsuite/g++.dg/diagnostic/inhibit-warn-1.C b/gcc/testsuite/g++.dg/diagnostic/inhibit-warn-1.C new file mode 100644 index 00000000000..5655eb44fd3 --- /dev/null +++ b/gcc/testsuite/g++.dg/diagnostic/inhibit-warn-1.C @@ -0,0 +1,32 @@ +// PR c++/65882 +// { dg-do compile { target c++11 } } +// { dg-options "-Wbool-compare" } + +// Check that we don't ICE because of reentering error reporting routines while +// evaluating template parameters + +template +struct type_function { + static constexpr bool value = false; +}; + +template +struct dependent_type { + typedef int type; +}; + +template +typename dependent_type<(5 > type_function::value)>::type +bar(); + +template +typename dependent_type<(5 > type_function::value)>::type +foo() +{ + return bar(); +} + +int main() +{ + foo(); +} diff --git a/gcc/testsuite/g++.dg/diagnostic/inhibit-warn-2.C b/gcc/testsuite/g++.dg/diagnostic/inhibit-warn-2.C new file mode 100644 index 00000000000..cb16b4cef8d --- /dev/null +++ b/gcc/testsuite/g++.dg/diagnostic/inhibit-warn-2.C @@ -0,0 +1,36 @@ +// PR c++/65882 +// PR c++/66467 +// { dg-do compile } + +template +struct A +{ + typedef int type; +}; + +struct B +{ + static const int value = 0; +}; + +template +struct C +{ + typedef int type; +}; + +template +struct F : B {}; + +class D +{ + template + typename A::type>::value || B::value>::type + operator=(Expr); // { dg-message "declared" } +}; + +void fn1() +{ + D opt; + opt = 0; // { dg-error "private" } +}