Commit 8dc9277a by Marek Polacek

re PR c++/82040 (ICE with -Wbool-operation and ~)

	PR c++/82040
	* typeck.c (cp_build_unary_op): Avoid re-entering reporting routines.

	* g++.dg/warn/Wbool-operation-1.C: New test.

From-SVN: r251581
parent 61fae4b1
2017-09-01 Marek Polacek <polacek@redhat.com>
PR c++/82040
* typeck.c (cp_build_unary_op): Avoid re-entering reporting routines.
2017-08-30 Jason Merrill <jason@redhat.com> 2017-08-30 Jason Merrill <jason@redhat.com>
PR c++/82029 - __PRETTY_FUNCTION__ in lambda in template PR c++/82029 - __PRETTY_FUNCTION__ in lambda in template
......
...@@ -5982,6 +5982,7 @@ cp_build_unary_op (enum tree_code code, tree xarg, bool noconvert, ...@@ -5982,6 +5982,7 @@ cp_build_unary_op (enum tree_code code, tree xarg, bool noconvert,
{ {
/* Warn if the expression has boolean value. */ /* Warn if the expression has boolean value. */
if (TREE_CODE (TREE_TYPE (arg)) == BOOLEAN_TYPE if (TREE_CODE (TREE_TYPE (arg)) == BOOLEAN_TYPE
&& (complain & tf_warning)
&& warning_at (location, OPT_Wbool_operation, && warning_at (location, OPT_Wbool_operation,
"%<~%> on an expression of type bool")) "%<~%> on an expression of type bool"))
inform (location, "did you mean to use logical not (%<!%>)?"); inform (location, "did you mean to use logical not (%<!%>)?");
......
2017-09-01 Marek Polacek <polacek@redhat.com>
PR c++/82040
* g++.dg/warn/Wbool-operation-1.C: New test.
2017-08-31 Claudiu Zissulescu <claziss@synopsys.com> 2017-08-31 Claudiu Zissulescu <claziss@synopsys.com>
* gcc.target/arc/sdata-5.c: New test. * gcc.target/arc/sdata-5.c: New test.
* gcc.target/arc/arc700-stld-hazard.c: Update test options. * gcc.target/arc/arc700-stld-hazard.c: Update test options.
2017-08-31 Claudiu Zissulescu <claziss@synopsys.com> 2017-08-31 Claudiu Zissulescu <claziss@synopsys.com>
......
// PR c++/82040
// { dg-do compile { target c++11 } }
// { dg-options "-Wbool-operation" }
template <class c>
decltype (~c{})
call ()
{
return ~false; // { dg-warning "on an expression of type bool" }
}
template int call<bool>();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment