Commit 84edfc8a by Jason Merrill Committed by Jason Merrill

pt.c (check_explicit_specialization): Check the namespace after we choose a template.

	* pt.c (check_explicit_specialization): Check the namespace after
	we choose a template.

From-SVN: r230271
parent 633ce971
2015-11-12 Jason Merrill <jason@redhat.com>
* pt.c (check_explicit_specialization): Check the namespace after
we choose a template.
2015-11-11 Jason Merrill <jason@redhat.com> 2015-11-11 Jason Merrill <jason@redhat.com>
* decl.c (duplicate_decls): When combining typedefs, remove the * decl.c (duplicate_decls): When combining typedefs, remove the
......
...@@ -2800,14 +2800,6 @@ check_explicit_specialization (tree declarator, ...@@ -2800,14 +2800,6 @@ check_explicit_specialization (tree declarator,
error ("%qD is not a template function", dname); error ("%qD is not a template function", dname);
fns = error_mark_node; fns = error_mark_node;
} }
else
{
tree fn = OVL_CURRENT (fns);
if (!is_associated_namespace (CP_DECL_CONTEXT (decl),
CP_DECL_CONTEXT (fn)))
error ("%qD is not declared in %qD",
decl, current_namespace);
}
} }
declarator = lookup_template_function (fns, NULL_TREE); declarator = lookup_template_function (fns, NULL_TREE);
...@@ -2941,6 +2933,14 @@ check_explicit_specialization (tree declarator, ...@@ -2941,6 +2933,14 @@ check_explicit_specialization (tree declarator,
return error_mark_node; return error_mark_node;
else else
{ {
if (!ctype && !was_template_id
&& (specialization || member_specialization
|| explicit_instantiation)
&& !is_associated_namespace (CP_DECL_CONTEXT (decl),
CP_DECL_CONTEXT (tmpl)))
error ("%qD is not declared in %qD",
tmpl, current_namespace);
tree gen_tmpl = most_general_template (tmpl); tree gen_tmpl = most_general_template (tmpl);
if (explicit_instantiation) if (explicit_instantiation)
......
void f();
namespace A {
template <class T> void f(T) { }
using ::f;
template void f(int);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment