From 767de87d05afc6574bf1c5812391b2d865ee817f Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 23 Jun 2011 12:53:03 -0400 Subject: [PATCH] re PR c++/49507 (ICE because of defaulted template destructor) PR c++/49507 * decl2.c (mark_used): Don't call synthesize_method for functions defaulted outside the class. From-SVN: r175342 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/decl2.c | 3 +++ gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/g++.dg/cpp0x/defaulted30.C | 16 ++++++++++++++++ 4 files changed, 26 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/defaulted30.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index cb230e25871..23aaac1c4f9 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2011-06-23 Jason Merrill + PR c++/49507 + * decl2.c (mark_used): Don't call synthesize_method for + functions defaulted outside the class. + * optimize.c (maybe_clone_body): Set linkage flags before cgraph_same_body_alias. diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index d2f075dab0a..9e5a2297190 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -4297,6 +4297,9 @@ mark_used (tree decl) if (TREE_CODE (decl) == FUNCTION_DECL && DECL_NONSTATIC_MEMBER_FUNCTION_P (decl) && DECL_DEFAULTED_FN (decl) + /* A function defaulted outside the class is synthesized either by + cp_finish_decl or instantiate_decl. */ + && !DECL_DEFAULTED_OUTSIDE_CLASS_P (decl) && ! DECL_INITIAL (decl)) { /* Remember the current location for a function we will end up diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ec75281ff21..8f6b625c3b3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2011-06-23 Jason Merrill + PR c++/49507 + * g++.dg/cpp0x/defaulted30.C: New. + PR c++/49440 * g++.dg/rtti/anon-ns1.C: New. diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted30.C b/gcc/testsuite/g++.dg/cpp0x/defaulted30.C new file mode 100644 index 00000000000..0bf4425b875 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/defaulted30.C @@ -0,0 +1,16 @@ +// PR c++/49507 +// { dg-options -std=c++0x } + +template +struct ConcretePoolKey +{ + virtual ~ConcretePoolKey(); +}; + +template +ConcretePoolKey::~ConcretePoolKey() = default; + +int main() +{ + ConcretePoolKey foo; +} -- 2.30.2