diff options
author | Jason Merrill <jason@redhat.com> | 2011-11-10 16:14:42 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2011-11-10 16:14:42 -0500 |
commit | 99c18869efe4d723a5c715696b65cd833dfee531 (patch) | |
tree | 806b310c0bd83c22387879b2fb22c9edd08e2f6f /gcc | |
parent | d660c35ea2ba7c23049d3c8c2e07bf7dbcf0aed9 (diff) | |
download | gcc-99c18869efe4d723a5c715696b65cd833dfee531.zip gcc-99c18869efe4d723a5c715696b65cd833dfee531.tar.gz gcc-99c18869efe4d723a5c715696b65cd833dfee531.tar.bz2 |
re PR c++/50973 ([C++0x] internal compiler error defaulted destructor virtual inheritance)
PR c++/50973
* decl2.c (mark_used): Defer synthesis of virtual functions.
* method.c (use_thunk): Make sure the target function has
DECL_INTERFACE_KNOWN.
From-SVN: r181272
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 10 | ||||
-rw-r--r-- | gcc/cp/method.c | 1 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/defaulted33.C | 32 |
5 files changed, 52 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4492b3b..11fa21d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,10 @@ 2011-11-10 Jason Merrill <jason@redhat.com> + PR c++/50973 + * decl2.c (mark_used): Defer synthesis of virtual functions. + * method.c (use_thunk): Make sure the target function has + DECL_INTERFACE_KNOWN. + PR c++/51079, DR 495 * call.c (joust): Check the second conversion sequence before checking templates. diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 4e24755..05f4b42 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -4347,6 +4347,14 @@ mark_used (tree decl) && !DECL_DEFAULTED_OUTSIDE_CLASS_P (decl) && ! DECL_INITIAL (decl)) { + /* Defer virtual destructors so that thunks get the right + linkage. */ + if (DECL_VIRTUAL_P (decl) && !at_eof) + { + note_vague_linkage_fn (decl); + return true; + } + /* Remember the current location for a function we will end up synthesizing. Then we can inform the user where it was required in the case of error. */ @@ -4358,7 +4366,7 @@ mark_used (tree decl) on the stack (such as overload resolution candidates). We could just let cp_write_global_declarations handle synthesizing - this function, since we just added it to deferred_fns, but doing + this function by adding it to deferred_fns, but doing it at the use site produces better error messages. */ ++function_depth; synthesize_method (decl); diff --git a/gcc/cp/method.c b/gcc/cp/method.c index bb58312..8101f8a 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -339,6 +339,7 @@ use_thunk (tree thunk_fndecl, bool emit_p) DECL_EXTERNAL (thunk_fndecl) = 0; /* The linkage of the function may have changed. FIXME in linkage rewrite. */ + gcc_assert (DECL_INTERFACE_KNOWN (function)); TREE_PUBLIC (thunk_fndecl) = TREE_PUBLIC (function); DECL_VISIBILITY (thunk_fndecl) = DECL_VISIBILITY (function); DECL_VISIBILITY_SPECIFIED (thunk_fndecl) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 90eded9..85f77a9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-11-10 Jason Merrill <jason@redhat.com> + + PR c++/50973 + * g++.dg/cpp0x/defaulted33.C: New. + 2011-11-10 Andrew MacLeod <amacleod@redhat.com> PR middle-end/51038 diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted33.C b/gcc/testsuite/g++.dg/cpp0x/defaulted33.C new file mode 100644 index 0000000..2f11c13 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/defaulted33.C @@ -0,0 +1,32 @@ +// PR c++/50973 +// { dg-do compile { target c++11 } } + +class HD +{ + public: + virtual ~HD() {}; +}; +class InputHD : public virtual HD +{ +}; +class OutputHD : public virtual HD +{ +}; +class IOHD : public InputHD, public OutputHD +{ +}; +template <typename T, unsigned int N> +class ArrayNHD : public IOHD +{ + public: + ~ArrayNHD() = default; +}; +class TLText +{ + ~TLText(); + ArrayNHD<int, 1>* m_argsHD; +}; +TLText::~TLText() +{ + delete m_argsHD; +} |