public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/50258] New: -std=gnu++0x should allow in-class initialization of static const floating types without constexpr
@ 2011-09-01  6:30 jyasskin at gcc dot gnu.org
  2011-09-01 11:51 ` [Bug c++/50258] [C++0x] " redi at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: jyasskin at gcc dot gnu.org @ 2011-09-01  6:30 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 50258
           Summary: -std=gnu++0x should allow in-class initialization of
                    static const floating types without constexpr
    Classification: Unclassified
           Product: gcc
           Version: 4.6.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jyasskin@gcc.gnu.org


In c++98 mode, gcc accepts in-class initialization of static const floating
members as an extension. This extension have been removed in C++0x mode, even
when gnu extensions are specifically requested with -std=gnu++0x. It would be
nice to keep the extension, especially since the C++0x draft was only changed
to disallow it in the FDIS.


$ gcc-4.6 --version
gcc-4.6 (GCC) 4.6.1
$ cat test.cc
struct Foo {
  static const double d = 3.14;
};
const double Foo::d;
$ gcc-4.6 -c -Wall test.cc
$ gcc-4.6 -c -Wall -std=gnu++0x test.cc
test.cc:2:27: error: 'constexpr' needed for in-class initialization of static
data member 'd' of non-integral type
test.cc:4:19: error: 'const double Foo::d' is not a static member of 'struct
Foo'
test.cc:4:14: error: uninitialized const 'Foo::d' [-fpermissive]
$


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2011-09-29 19:28 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-01  6:30 [Bug c++/50258] New: -std=gnu++0x should allow in-class initialization of static const floating types without constexpr jyasskin at gcc dot gnu.org
2011-09-01 11:51 ` [Bug c++/50258] [C++0x] " redi at gcc dot gnu.org
2011-09-23 11:59 ` paolo.carlini at oracle dot com
2011-09-23 12:29 ` redi at gcc dot gnu.org
2011-09-23 12:57 ` paolo.carlini at oracle dot com
2011-09-23 13:14 ` jason at gcc dot gnu.org
2011-09-23 13:19 ` paolo.carlini at oracle dot com
2011-09-23 16:38 ` paolo at gcc dot gnu.org
2011-09-23 17:02 ` paolo.carlini at oracle dot com
2011-09-29 10:46 ` bsys.com.ar at gmail dot com
2011-09-29 11:58 ` redi at gcc dot gnu.org
2011-09-29 20:37 ` bsys.com.ar at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).