re PR c++/49507 (ICE because of defaulted template destructor)
authorJason Merrill <jason@redhat.com>
Thu, 23 Jun 2011 16:53:03 +0000 (12:53 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 23 Jun 2011 16:53:03 +0000 (12:53 -0400)
PR c++/49507
* decl2.c (mark_used): Don't call synthesize_method for
functions defaulted outside the class.

From-SVN: r175342

gcc/cp/ChangeLog
gcc/cp/decl2.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/defaulted30.C [new file with mode: 0644]

index cb230e25871c739f1df29fe3311239cecd601429..23aaac1c4f985d33ded2123a1b9406dc64d8b3b9 100644 (file)
@@ -1,5 +1,9 @@
 2011-06-23  Jason Merrill  <jason@redhat.com>
 
+       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.
 
index d2f075dab0a2b032e343869232f6470888d3ad3a..9e5a2297190383bd9ed962a1f434bfd0cfd46cfa 100644 (file)
@@ -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
index ec75281ff211be793fac44451e8730288313fe84..8f6b625c3b383deadd065c306b094d628ca9e550 100644 (file)
@@ -1,5 +1,8 @@
 2011-06-23  Jason Merrill  <jason@redhat.com>
 
+       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 (file)
index 0000000..0bf4425
--- /dev/null
@@ -0,0 +1,16 @@
+// PR c++/49507
+// { dg-options -std=c++0x }
+
+template<typename T>
+struct ConcretePoolKey
+{
+        virtual ~ConcretePoolKey();
+};
+
+template<typename T>
+ConcretePoolKey<T>::~ConcretePoolKey() = default;
+
+int main()
+{
+        ConcretePoolKey<int> foo;
+}