https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71985
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|DUPLICATE |---
--- Comment #7 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
A simpler testcase:
#include <vector>
double d;
std::vector<int> v1 { d, 0.0, 0 };
prog.cc:3:33: warning: narrowing conversion of 'd' from 'double' to 'int'
inside { } [-Wnarrowing]
std::vector<int> v1 { d, 0.0, 0 };
^
prog.cc:3:33: warning: narrowing conversion of 'd' from 'double' to 'int'
inside { } [-Wnarrowing]
prog.cc:3:33: error: narrowing conversion of '0.0' from 'double' to 'int'
inside { } [-Wnarrowing]
It doesn't make sense that we give a warning for 'd' if no value of 'd' would
ever give a warning.
This case is different from:
int i;
char c[] = { i, 0 };