This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/55080] New: -pedantic produces error: floating-point literal cannot appear in a constant-expression
- From: "manu at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 26 Oct 2012 11:35:20 +0000
- Subject: [Bug c++/55080] New: -pedantic produces error: floating-point literal cannot appear in a constant-expression
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55080
Bug #: 55080
Summary: -pedantic produces error: floating-point literal
cannot appear in a constant-expression
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Keywords: accepts-invalid
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: manu@gcc.gnu.org
CC: fang@csl.cornell.edu, manu@gcc.gnu.org, matz@suse.de,
papadopo@shfj.cea.fr, rearnsha@gcc.gnu.org,
rguenth@gcc.gnu.org, rnewman@compubrite.com
Depends on: 11393
Build: any
+++ This bug was initially created as a clone of Bug #11393 +++
class B {
static const int c = 3.1415926;
};
-std=c++98 -pedantic gives
error: floating-point literal cannot appear in a constant-expression
static const int c = 3.1415926;
^
and -std=c++98 gives nothing. Both -std=c++11 -pedantic and just -std=c++11
report nothing.
This is a bug. -pedantic should not produce errors. If this is a GNU extension
in c++98 mode, then it should produce a warning like:
warning: ISO C++98 forbids using a floating-point literal in a
constant-expression [-Wpedantic]