diff mbox

[C++] PR 50258

Message ID 4E7C8AFC.7040604@oracle.com
State New
Headers show

Commit Message

Paolo Carlini Sept. 23, 2011, 1:34 p.m. UTC
Hi,

so this is what I'm finishing testing on x86_64-linux. Ok?

Thanks,
Paolo.

////////////////////////
/cp
2011-09-23  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/50258
	* decl.c (check_static_variable_definition): Allow in-class
	initialization of static data member of non-integral type in
	permissive mode.

/testsuite
2011-09-23  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/50258
	* g++.dg/cpp0x/constexpr-static8.C: New.

Comments

Jason Merrill Sept. 23, 2011, 3:44 p.m. UTC | #1
OK.

Jason
diff mbox

Patch

Index: testsuite/g++.dg/cpp0x/constexpr-static8.C
===================================================================
--- testsuite/g++.dg/cpp0x/constexpr-static8.C	(revision 0)
+++ testsuite/g++.dg/cpp0x/constexpr-static8.C	(revision 0)
@@ -0,0 +1,7 @@ 
+// PR c++/50258
+// { dg-options "-std=c++0x -fpermissive" }
+
+struct Foo {
+  static const double d = 3.14; // { dg-warning "constexpr" }
+};
+const double Foo::d;            // { dg-warning "constexpr" }
Index: cp/decl.c
===================================================================
--- cp/decl.c	(revision 179116)
+++ 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);
+	permerror (input_location,
+		   "%<constexpr%> needed for in-class initialization of "
+		   "static data member %q#D of non-integral type", decl);
       else
 	error ("in-class initialization of static data member %q#D of "
 	       "non-literal type", decl);