This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/36963] New: [4.4 Regression] Bogus narrowing conversion error in initializer list.
- From: "chris dot fairles at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Jul 2008 12:54:58 -0000
- Subject: [Bug c++/36963] New: [4.4 Regression] Bogus narrowing conversion error in initializer list.
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
gcc 4.1.2 (x86_64-redhat-linux mind you) and gcc 4.4.0 (mainline) with (or
without) any/all of -Wall -Wextra -pendantic compiles the following code
without error/warning.
const float* foo()
{
static const float p[] = {
-0.02435L
}
return p;
}
However, add in -std=c++0x/gnu++0x and the following error is issued:
error: narrowing conversion of
-2.43499999999999999996828708645479899530528200557455420494e-2l to const float
inside { }
Now change the testcase to:
const float* foo()
{
static const float p[] = {
-0.25L
}
return p;
}
and it compiles w/o error/warning with -std=c++/gnu++0x
--
Summary: [4.4 Regression] Bogus narrowing conversion error in
initializer list.
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: chris dot fairles at gmail dot com
GCC build triplet: x86_64-unknown-linux-gnu
GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36963