Commit 6c5613b0 by Jason Merrill Committed by Jason Merrill

re PR c++/34094 (Undefined static data member in anonymous namespace can acquire…

re PR c++/34094 (Undefined static data member in anonymous namespace can acquire a definition anyway)

        PR c++/34094
        * decl2.c (cp_write_global_declarations): Don't write out static
        data members with DECL_IN_AGGR_P set.

From-SVN: r132218
parent ef4195d6
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
......
......@@ -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
......
// 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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment