re PR c++/55893 ([C++11] runtime segfault with static const object with virtual destructor)
PR c++/55893 * decl.c (cp_finish_decl): Clear TREE_READONLY if the variable needs destruction. From-SVN: r195062
This commit is contained in:
parent
9a002da86b
commit
96924e7e64
@ -1,3 +1,9 @@
|
||||
2013-01-09 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/55893
|
||||
* decl.c (cp_finish_decl): Clear TREE_READONLY if the variable
|
||||
needs destruction.
|
||||
|
||||
2013-01-09 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c/48418
|
||||
|
@ -6417,6 +6417,10 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
|
||||
}
|
||||
else if (was_readonly)
|
||||
TREE_READONLY (decl) = 1;
|
||||
|
||||
/* Likewise if it needs destruction. */
|
||||
if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type))
|
||||
TREE_READONLY (decl) = 0;
|
||||
}
|
||||
|
||||
make_rtl_for_nonlocal_decl (decl, init, asmspec);
|
||||
|
12
gcc/testsuite/g++.dg/init/const9.C
Normal file
12
gcc/testsuite/g++.dg/init/const9.C
Normal file
@ -0,0 +1,12 @@
|
||||
// PR c++/55893
|
||||
// { dg-final { scan-assembler-not "rodata" } }
|
||||
|
||||
struct foo
|
||||
{
|
||||
virtual ~foo ();
|
||||
};
|
||||
|
||||
int main ()
|
||||
{
|
||||
static const foo tmp;
|
||||
}
|
Loading…
Reference in New Issue
Block a user