------- Comment #2 from chris dot fairles at gmail dot com  2008-08-02 18:41 
-------
(In reply to comment #1)
> AFAIK, the error is a request of the c++0x standard and it seems -0.02435L 
> does
> not fit exactly in a float while  -0.25L does, so the message is correct and I
> thus I don't think there is a bug here. 
> 
> Perhaps it should be a permissive error, so users can compile legacy code in
> c++0x mode.
> 
> CCing Jason.
> 

I think you are right. Section 8.5.4 - List-initialization, in the current WD
(N2691) says that a narrowing conversion from double to float is only allowed
if the conversion is of a literal value and the value can fit into the
destination type such that it produces the exact same value when coverted back.
Then from 8.5.4 paragraph 3, 3rd bullet, if any argument requires a narrowing
conversion, the program is ill-formed.

If you use the "f" post-fix in the test case, no narrowing conversion is
required and the error is not issued as expected.

This can be marked as invalid I believe.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36963

Reply via email to