https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80601
Bug ID: 80601 Summary: spurious -Wconversion warning with explicit class template arguments Product: gcc Version: 7.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jens.maurer at gmx dot net Target Milestone: --- The all-new gcc 7.1.0 has introduced a conversion warning in template definition context when a value-dependent sizeof is used as a template argument for a class template. (There is no warning for something like "f<sizeof(T)>()".) Note that the program below has no instantiation of "g", and I believe a -Wconversion warning should not trigger when a constant value is used that fits the target type. g++ -Wconversion -c x.cc x.cc: In function ‘int g(T)’: x.cc:7:11: warning: conversion to ‘unsigned int’ from ‘long unsigned int’ may alter its value [-Wconversion] S<sizeof(T)> s; template<unsigned int N> struct S { }; template<class T> void g(T) { S<sizeof(T)> s; }