commit d64070bb7f98ecbf0f1bec46f0a5acb018b60ab1
Author: Jason Merrill <jason@redhat.com>
Date: Tue Apr 16 13:30:34 2013 +0100
DR 941
* decl.c (duplicate_decls): Don't propagate DECL_DELETED_FN to
template specializations.
@@ -1764,12 +1764,16 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
warning (OPT_Wredundant_decls, "previous declaration of %q+D", olddecl);
}
- if (DECL_DELETED_FN (newdecl))
+ if (!(DECL_TEMPLATE_INSTANTIATION (olddecl)
+ && DECL_TEMPLATE_SPECIALIZATION (newdecl)))
{
- error ("deleted definition of %qD", newdecl);
- error ("after previous declaration %q+D", olddecl);
+ if (DECL_DELETED_FN (newdecl))
+ {
+ error ("deleted definition of %qD", newdecl);
+ error ("after previous declaration %q+D", olddecl);
+ }
+ DECL_DELETED_FN (newdecl) |= DECL_DELETED_FN (olddecl);
}
- DECL_DELETED_FN (newdecl) |= DECL_DELETED_FN (olddecl);
}
/* Deal with C++: must preserve virtual function table size. */
new file mode 100644
@@ -0,0 +1,10 @@
+// DR 941
+// { dg-require-effective-target c++11 }
+
+template <class T> T f(T) = delete;
+template<> int f(int) { return 42; }
+
+int main()
+{
+ f(42);
+}