diff options
author | Jakub Jelinek <jakub@redhat.com> | 2007-12-11 09:22:10 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2007-12-11 09:22:10 +0100 |
commit | 5b767b9d0c2c2b2646aeadfa2c8156dde7a085fc (patch) | |
tree | 78ec16b06acbfa9666452cfa650bb987f92c4688 /gcc/cp | |
parent | 61a861e6868242b07f7a06f5981681061093a69f (diff) | |
download | gcc-5b767b9d0c2c2b2646aeadfa2c8156dde7a085fc.tar.gz |
re PR c++/34238 ("static data member used, but not defined" error on member definition)
PR c++/34238
* decl2.c (cp_write_global_declarations): Revert 2007-11-22 change.
* g++.dg/ext/visibility/anon7.C: Add xfail.
* g++.dg/ext/visibility/anon9.C: New test.
* g++.dg/ext/visibility/anon10.C: New test.
From-SVN: r130771
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 16 |
2 files changed, 4 insertions, 15 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f55b06a4583..f8df2b23919 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2007-12-11 Jakub Jelinek <jakub@redhat.com> + PR c++/34238 + * decl2.c (cp_write_global_declarations): Revert 2007-11-22 change. + PR c++/34364 * rtti.c (build_dynamic_cast): Call convert_from_reference even for dynamic_cast in a template. diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 37a21f7040d..97b3ee0f3f2 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -3366,21 +3366,7 @@ cp_write_global_declarations (void) /* If this static data member is needed, provide it to the back end. */ if (DECL_NOT_REALLY_EXTERN (decl) && decl_needed_p (decl)) - { - /* Error on - namespace { struct A { static int i; }; } - int foo () { return A::i; } - without A::i definition (which can't be defined in - a different CU because of the anonymous namespace). - Don't do this if DECL_INITIAL is set, because for - namespace { struct A { static const int i = 4; } }; - decl_needed_p won't reliably detect whether it was - really needed. */ - if (DECL_IN_AGGR_P (decl) && DECL_INITIAL (decl) == NULL_TREE) - error ("%Jstatic data member %qD used, but not defined", - decl, decl); - DECL_EXTERNAL (decl) = 0; - } + DECL_EXTERNAL (decl) = 0; } if (VEC_length (tree, pending_statics) != 0 && wrapup_global_declarations (VEC_address (tree, pending_statics), |