diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-02-10 18:12:01 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-02-10 18:12:01 +0000 |
commit | 24eb59165f7cc002fa79fd28f54d3840584354f6 (patch) | |
tree | 72ca3c96995df6c26b09f40f3d259094de8e1de9 /gcc | |
parent | 533d0ceb28088c9b755731b0a9179dbc857b7e72 (diff) | |
download | ppe42-gcc-24eb59165f7cc002fa79fd28f54d3840584354f6.tar.gz ppe42-gcc-24eb59165f7cc002fa79fd28f54d3840584354f6.zip |
PR c++/34094
* decl2.c (cp_write_global_declarations): Don't write out static
data members with DECL_IN_AGGR_P set.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@132218 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/other/anon5.C | 21 |
3 files changed, 30 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index da9668da2ad..9dc4362acc3 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2008-02-10 Jason Merrill <jason@redhat.com> + + PR c++/34094 + * decl2.c (cp_write_global_declarations): Don't write out static + data members with DECL_IN_AGGR_P set. + 2008-02-08 Jason Merrill <jason@redhat.com> PR c++/35116 diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index d2d81feae44..1832926eb31 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -3396,7 +3396,9 @@ cp_write_global_declarations (void) /* Static data members are just like namespace-scope globals. */ for (i = 0; VEC_iterate (tree, pending_statics, i, decl); ++i) { - if (var_finalized_p (decl) || DECL_REALLY_EXTERN (decl)) + if (var_finalized_p (decl) || DECL_REALLY_EXTERN (decl) + /* Don't write it out if we haven't seen a definition. */ + || DECL_IN_AGGR_P (decl)) continue; import_export_decl (decl); /* If this static data member is needed, provide it to the diff --git a/gcc/testsuite/g++.dg/other/anon5.C b/gcc/testsuite/g++.dg/other/anon5.C new file mode 100644 index 00000000000..68a02880b21 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/anon5.C @@ -0,0 +1,21 @@ +// PR c++/34094 +// { dg-do link } +// { dg-options "-g" } + +namespace { + struct c + { + static const bool t = 0; + }; +} + +const bool &f() +{ + return c::t; // { dg-error "undefined" } +} + +int main(void) +{ + return 0; +} + |