[Bug c++/44500] [C++0x] Bogus narrowing conversion error
gpiez at web dot de
gcc-bugzilla@gcc.gnu.org
Fri Jun 11 13:27:00 GMT 2010
------- Comment #9 from gpiez at web dot de 2010-06-11 13:27 -------
I understand now after the implicit promotion to int of a non constant value
the result of the narrowing operation can't be guaranteed to fit in the
original type. But I still think it shouldn't give an error, and if the
standard says so, I think it is flawed in this regard ;-)
Consider
g<INT_MAX, INT_MAX>(); // Warning, but no Error
despite it can be proven that the value will not fit and this is very likely an
error. Opposing to
char c,d;
A a = { c+d };
which is very likely not an error and would only require a mild warning. IMHO.
Manuel, in your testcase, you do not only warn, you error out if compiled with
-std=c++0x.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44500
More information about the Gcc-bugs
mailing list