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: unassig...@gcc.gnu.org

        ReportedBy: m...@gcc.gnu.org

                CC: f...@csl.cornell.edu, m...@gcc.gnu.org, m...@suse.de,

                    papad...@shfj.cea.fr, rearn...@gcc.gnu.org,

                    rgue...@gcc.gnu.org, rnew...@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]

Reply via email to