===================================================================
@@ -1922,7 +1922,9 @@ duplicate_decls (tree newdecl, tree olddecl, bool
{
/* Per C++11 8.3.6/4, default arguments cannot be added in later
declarations of a function template. */
- check_redeclaration_no_default_args (newdecl);
+ if (DECL_SOURCE_LOCATION (newdecl)
+ != DECL_SOURCE_LOCATION (olddecl))
+ check_redeclaration_no_default_args (newdecl);
check_default_args (newdecl);
===================================================================
@@ -0,0 +1,11 @@
+// PR c++/65370
+
+template <typename> class C
+{
+ template <typename U>
+ C(const C<U>&, bool = false);
+};
+
+template <>
+template <typename U>
+C<int>::C(const C<U>&, bool);
===================================================================
@@ -0,0 +1,16 @@
+// PR c++/65370
+
+template <typename> class C
+{
+ template <typename U>
+ C(const C<U>&, bool = false);
+};
+
+template<>
+class C<int>
+{
+ template <typename U>
+ C(const C<U>&, bool);
+};
+
+template <typename U> C<int>::C(const C<U>&, bool = false) { } // { dg-error "default arguments" }