https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86237
Bug ID: 86237 Summary: Narrowing from int to bool is not allowed in a non type template argument Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: zhonghao at pku dot org.cn Target Milestone: --- The code sample is as follow: enum { E = 2 }; template <bool> void f(int) {} template <int> void f() {} int main () { f<1 * 1>(); f<1 << 1>(); f<1 ? 3 : 2>(); f<E>(); f<1 * 1>(0); f<1 << 1>(0); f<1 ? 3 : 2>(0); f<E>(0); } clang++ rejects it with error messages: error: no matching function for call to 'f' f<1 << 1>(0); error: no matching function for call to 'f' f<1 ? 3 : 2>(0); The code comes from the test suite of gcc (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79184) I tried g++ -std=c++11, but it still accepts the code. I thought that this is a bug in clang, and reported it to https://bugs.llvm.org/show_bug.cgi?id=37866 Richard Smith believe that this is a gcc bug. Shall gcc repair the problem?