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
This commit is contained in:
parent
ef4195d63d
commit
6c5613b043
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue