[Bug c++/79184] New: -Wint-in-bool-context triggered erroneously in template parameter
jagerman at jagerman dot com
gcc-bugzilla@gcc.gnu.org
Sun Jan 22 16:47:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79184
Bug ID: 79184
Summary: -Wint-in-bool-context triggered erroneously in
template parameter
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jagerman at jagerman dot com
Target Milestone: ---
When compiling the following with -Wint-in-bool-context under a recent snapshot
of g++-7:
template <bool> void f(int) {}
template <int> void f() {}
int main() {
f<1*1>();
}
`g++ -Wint-in-bool-context t.cpp' produces the warning:
t.cpp: In function 'int main()':
t.cpp:5:8: warning: '*' in boolean context, suggest '&&' instead
[-Wint-in-bool-context]
f<1*1>();
~^~
But this is wrong: the template parameter here is int, not a bool, and is not
in bool context. The existence of the templated overload, despite not being
called in this context, appears to be falsely triggering the warning.
More information about the Gcc-bugs
mailing list