From: jason Date: Sun, 10 Feb 2008 18:12:01 +0000 (+0000) Subject: PR c++/34094 X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=commitdiff_plain;h=24eb59165f7cc002fa79fd28f54d3840584354f6;hp=533d0ceb28088c9b755731b0a9179dbc857b7e72 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 --- 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 + + 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 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; +} +