c++: Disable -Wint-in-bool-context in instantiations
authorMarek Polacek <polacek@redhat.com>
Wed, 12 May 2021 15:19:13 +0000 (11:19 -0400)
committerMarek Polacek <polacek@redhat.com>
Wed, 12 May 2021 17:06:28 +0000 (13:06 -0400)
commit3a2b12bc5a7da7f0c5cf2ef4879d435a02feda8d
tree2407ce65a6581f1fac2fff5020ab9d31901dd893
parentfa6894ec9ce25f5aff10ec176212383f5c88b1ec
c++: Disable -Wint-in-bool-context in instantiations

This warning is of questionable value when it's emitted when
instantiating a template, as in the following testcase.  It could be
silenced by writing hb(i) << 1 instead of 2 * hb(i) but that's
unnecessary obfuscation.

gcc/cp/ChangeLog:

* pt.c (tsubst_copy_and_build): Add warn_int_in_bool_context
sentinel.

gcc/testsuite/ChangeLog:

* g++.dg/warn/Wint-in-bool-context-2.C: New test.
gcc/cp/pt.c
gcc/testsuite/g++.dg/warn/Wint-in-bool-context-2.C [new file with mode: 0644]