OSDN Git Service

PR c++/50531
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 18 Oct 2011 19:36:28 +0000 (19:36 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 18 Oct 2011 19:36:28 +0000 (19:36 +0000)
* pt.c (instantiate_decl): Recognize when a function defaulted
outside the class is already instantiated.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@180162 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 24ca654..402f5b5 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 6fc60d5..56fa632 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 d2cf1a8..ed9a8e6 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)
+{}