===================================================================
@@ -7822,6 +7822,8 @@ grokfndecl (tree ctype,
decl, ctype);
return NULL_TREE;
}
+ if (ok == error_mark_node)
+ return NULL_TREE;
return old_decl;
}
}
===================================================================
@@ -19698,7 +19699,8 @@ instantiate_decl (tree d, int defer_ok,
if (at_eof && !pattern_defined
&& DECL_EXPLICIT_INSTANTIATION (d)
- && DECL_NOT_REALLY_EXTERN (d))
+ && DECL_NOT_REALLY_EXTERN (d)
+ && (TREE_CODE (d) != FUNCTION_DECL || !DECL_DELETED_FN (d)))
/* [temp.explicit]
The definition of a non-exported function template, a
===================================================================
@@ -0,0 +1,11 @@
+// PR c++/58582
+// { dg-do compile { target c++11 } }
+
+struct A
+{
+ template<int> void foo() = delete;
+};
+
+template<int> void A::foo() { int i; } // { dg-error "redefinition" }
+
+template void A::foo<0>();
===================================================================
@@ -0,0 +1,11 @@
+// PR c++/58582
+// { dg-do compile { target c++11 } }
+
+struct A
+{
+ template<int> void foo() = delete;
+};
+
+template<int> void A::foo() {} // { dg-error "redefinition" }
+
+template void A::foo<0>();
===================================================================
@@ -0,0 +1,9 @@
+// PR c++/58582
+// { dg-do compile { target c++11 } }
+
+struct A
+{
+ template<int> void foo() = delete;
+};
+
+template void A::foo<0>();