https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86298
Bug ID: 86298 Summary: template argument cannot be narrowed to type 'int' Product: gcc Version: 8.0.1 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 <typename ,int, int = 9223372036854775807L > struct as_nview { }; template <typename Sequence, int I0> struct as_nview<Sequence, I0> { }; g++ produces only a warning message, and it points to a wrong location: warning: overflow in conversion from 'long int' to 'int' changes value from '9223372036854775807' to '-1' [-Woverflow] struct as_nview<Sequence, I0> ^ Instead, clang++ rejects the code: error: non-type template argument evaluates to 9223372036854775807, which cannot be narrowed to type 'int' [-Wc++11-narrowing] template <typename ,int, int = 9223372036854775807L > The error message of clang++ seem to be more reasonable, right?