]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/50531 ([C++0x] ICE on defaulted template destructor)
authorJason Merrill <jason@redhat.com>
Tue, 18 Oct 2011 19:36:28 +0000 (15:36 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 18 Oct 2011 19:36:28 +0000 (15:36 -0400)
PR c++/50531
* pt.c (instantiate_decl): Recognize when a function defaulted
outside the class is already instantiated.

From-SVN: r180162

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

index 24ca6548d1c0aac768ad15edc123435d80cb0240..402f5b56c34f197c1195b5165cd3b50553d2f5b8 100644 (file)
@@ -1,5 +1,9 @@
 2011-10-18  Jason Merrill  <jason@redhat.com>
 
+       PR c++/50531
+       * pt.c (instantiate_decl): Recognize when a function defaulted
+       outside the class is already instantiated.
+
        PR c++/50742
        * decl.c (check_previous_goto_1): Handle using-decl.
 
index 6fc60d5ab8082100bf7f326c202e86e8c54f5b5b..56fa6324ad45c8dab776bfd6fd70077d76adc3ff 100644 (file)
@@ -18045,6 +18045,8 @@ instantiate_decl (tree d, int defer_ok,
     d = DECL_CLONED_FUNCTION (d);
 
   if (DECL_TEMPLATE_INSTANTIATED (d)
+      || (TREE_CODE (d) == FUNCTION_DECL
+         && DECL_DEFAULTED_FN (d) && DECL_INITIAL (d))
       || DECL_TEMPLATE_SPECIALIZATION (d))
     /* D has already been instantiated or explicitly specialized, so
        there's nothing for us to do here.
index d2cf1a83df5166cc593565d634281a4a9d65f853..ed9a8e61640c6c9454fe7506ea8cd074734c2c11 100644 (file)
@@ -1,5 +1,8 @@
 2011-10-18  Jason Merrill  <jason@redhat.com>
 
+       PR c++/50531
+       * g++.dg/cpp0x/defaulted32.C: New.
+
        PR c++/50742
        * g++.dg/lookup/using23.C: New.
 
diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted32.C b/gcc/testsuite/g++.dg/cpp0x/defaulted32.C
new file mode 100644 (file)
index 0000000..351cdae
--- /dev/null
@@ -0,0 +1,21 @@
+// PR c++/50531
+// { dg-options -std=c++0x }
+
+template <typename T>
+class DataFilter
+{
+ public:
+  inline virtual ~DataFilter();
+};
+
+template<typename T>
+inline DataFilter<T>::~DataFilter() = default;
+
+class ARCalculator : public DataFilter<ARCalculator>
+{
+ public:
+  virtual void dataStart(int, int);
+};
+
+void ARCalculator::dataStart(int, int)
+{}