[Bug c++/86596] New: non-type template argument evaluates to an integer
zhonghao at pku dot org.cn
gcc-bugzilla@gcc.gnu.org
Fri Jul 20 00:41:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86596
Bug ID: 86596
Summary: non-type template argument evaluates to an integer
Product: gcc
Version: 9.0
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 is as follow:
template<char i> struct A {};
typedef A<255> B;
int main() { return 0; }
g++ accepts the code, but clang++ rejects it:
char.cpp:3:11: error: non-type template argument evaluates to 255, which
cannot be narrowed to type 'char' [-Wc++11-narrowing]
typedef A<255> B;
^
1 error generated.
The code looks illegal, so the diagnose of clang++ is right?
More information about the Gcc-bugs
mailing list