[Bug c++/36963] [4.4 Regression] Bogus narrowing conversion error in initializer list.

2008-08-04 Thread jason at gcc dot gnu dot org


--- Comment #7 from jason at gcc dot gnu dot org  2008-08-04 19:55 ---
Subject: Bug 36963

Author: jason
Date: Mon Aug  4 19:53:57 2008
New Revision: 138652

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=138652
Log:
PR c++/36963
* typeck2.c (check_narrowing): Allow narrowing conversion
from an explicit floating-point constant.

Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/typeck2.c
trunk/gcc/testsuite/g++.dg/cpp0x/initlist5.C


-- 


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



[Bug c++/36963] [4.4 Regression] Bogus narrowing conversion error in initializer list.

2008-08-02 Thread manu at gcc dot gnu dot org


--- Comment #1 from manu at gcc dot gnu dot org  2008-08-02 15:28 ---
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.


-- 

manu at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||jason at redhat dot com,
   ||manu at gcc dot gnu dot org


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



[Bug c++/36963] [4.4 Regression] Bogus narrowing conversion error in initializer list.

2008-08-02 Thread chris dot fairles at gmail dot com


--- 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



[Bug c++/36963] [4.4 Regression] Bogus narrowing conversion error in initializer list.

2008-08-02 Thread manu at gcc dot gnu dot org


--- Comment #3 from manu at gcc dot gnu dot org  2008-08-02 19:02 ---
OK. Invalid then.


-- 

manu at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution||FIXED


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



[Bug c++/36963] [4.4 Regression] Bogus narrowing conversion error in initializer list.

2008-08-02 Thread manu at gcc dot gnu dot org


--- Comment #4 from manu at gcc dot gnu dot org  2008-08-02 19:04 ---
Reopened...


-- 

manu at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|RESOLVED|UNCONFIRMED
 Resolution|FIXED   |


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



[Bug c++/36963] [4.4 Regression] Bogus narrowing conversion error in initializer list.

2008-08-02 Thread manu at gcc dot gnu dot org


--- Comment #5 from manu at gcc dot gnu dot org  2008-08-02 19:05 ---
... to close as INVALID.


-- 

manu at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution||INVALID


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



[Bug c++/36963] [4.4 Regression] Bogus narrowing conversion error in initializer list.

2008-08-02 Thread jason at gcc dot gnu dot org


--- Comment #6 from jason at gcc dot gnu dot org  2008-08-03 03:01 ---
There is an open issue about this problem which should be addressed at the next
meeting.  I'm quite sure this will not be invalid C++0x when the standard is
finished.


-- 

jason at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|RESOLVED|UNCONFIRMED
 Resolution|INVALID |


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



[Bug c++/36963] [4.4 Regression] Bogus narrowing conversion error in initializer list.

2008-08-02 Thread jason at gcc dot gnu dot org


-- 

jason at gcc dot gnu dot org changed:

   What|Removed |Added

 AssignedTo|unassigned at gcc dot gnu   |jason at gcc dot gnu dot org
   |dot org |
 Status|UNCONFIRMED |ASSIGNED
 Ever Confirmed|0   |1
   Last reconfirmed|-00-00 00:00:00 |2008-08-03 03:01:20
   date||


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