diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/decl.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/constexpr-static8.C | 7 |
4 files changed, 22 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 249cab6..9e655cc 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +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. + 2011-09-22 Paolo Carlini <paolo.carlini@oracle.com> PR c++/50491 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 86fd2d5..709deca 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -7716,8 +7716,9 @@ check_static_variable_definition (tree decl, tree type) 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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 37f5bec..174b20f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-09-23 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/50258 + * g++.dg/cpp0x/constexpr-static8.C: New. + 2011-09-23 Jakub Jelinek <jakub@redhat.com> * gcc.target/i386/avxfp-1.c: New test. diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-static8.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-static8.C new file mode 100644 index 0000000..7c84cf8 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-static8.C @@ -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" } |