[Bug c++/50258] [C++0x] -std=gnu++0x should allow in-class initialization of static const floating types without constexpr

paolo.carlini at oracle dot com gcc-bugzilla@gcc.gnu.org
Fri Sep 23 11:59:00 GMT 2011


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

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-09-23 11:27:49 UTC ---
Jason, what are we going to do about this? For the record, something like the
below would pass the testsuite...

///////////////

Index: cp/decl.c
===================================================================
--- cp/decl.c   (revision 179115)
+++ cp/decl.c   (working copy)
@@ -7716,8 +7716,9 @@ check_static_variable_definition (tree decl, tree
   else if (cxx_dialect >= cxx0x && !INTEGRAL_OR_ENUMERATION_TYPE_P (type))
     {
       if (literal_type_p (type))
-       error ("%<constexpr%> needed for in-class initialization of static "
-              "data member %q#D of non-integral type", decl);
+       pedwarn (input_location, OPT_pedantic,
+                "%<constexpr%> needed for in-class initialization of static "
+                "data member %q#D of non-integral type %qT", decl, type);
       else
        error ("in-class initialization of static data member %q#D of "
               "non-literal type", decl);



More information about the Gcc-bugs mailing list