c++: fix error reporting routines re-entered ICE [PR110175]
Here we get the "error reporting routines re-entered" ICE because of an unguarded use of warning_at. While at it, I added a check for a warning_at just above it. PR c++/110175 gcc/cp/ChangeLog: * typeck.cc (cp_build_unary_op): Check tf_warning before warning. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/decltype-110175.C: New test.
This commit is contained in:
parent
8719ab0d01
commit
4de22e2591
2 changed files with 9 additions and 2 deletions
|
@ -7561,7 +7561,8 @@ cp_build_unary_op (enum tree_code code, tree xarg, bool noconvert,
|
|||
/* [depr.volatile.type] "Postfix ++ and -- expressions and
|
||||
prefix ++ and -- expressions of volatile-qualified arithmetic
|
||||
and pointer types are deprecated." */
|
||||
if (TREE_THIS_VOLATILE (arg) || CP_TYPE_VOLATILE_P (TREE_TYPE (arg)))
|
||||
if ((TREE_THIS_VOLATILE (arg) || CP_TYPE_VOLATILE_P (TREE_TYPE (arg)))
|
||||
&& (complain & tf_warning))
|
||||
warning_at (location, OPT_Wvolatile,
|
||||
"%qs expression of %<volatile%>-qualified type is "
|
||||
"deprecated",
|
||||
|
@ -7592,7 +7593,7 @@ cp_build_unary_op (enum tree_code code, tree xarg, bool noconvert,
|
|||
return error_mark_node;
|
||||
}
|
||||
/* Otherwise, [depr.incr.bool] says this is deprecated. */
|
||||
else
|
||||
else if (complain & tf_warning)
|
||||
warning_at (location, OPT_Wdeprecated,
|
||||
"use of an operand of type %qT "
|
||||
"in %<operator++%> is deprecated",
|
||||
|
|
6
gcc/testsuite/g++.dg/cpp0x/decltype-110175.C
Normal file
6
gcc/testsuite/g++.dg/cpp0x/decltype-110175.C
Normal file
|
@ -0,0 +1,6 @@
|
|||
// PR c++/110175
|
||||
// { dg-do compile { target c++11 } }
|
||||
|
||||
template<class T> auto f(T t) -> decltype(++t) { return t; } // { dg-warning "reference" "" { target c++14_down } }
|
||||
void f(...) {}
|
||||
void g() { f(true); }
|
Loading…
Add table
Reference in a new issue