Commit 64776356 by Jason Merrill Committed by Jason Merrill

re PR c++/28300 (In-class partial specialization of class accepted)

	PR c++/28300
	PR c++/42062
	* pt.c (check_specialization_namespace): Complain about
	specialization at non-namespace scope.

From-SVN: r155349
parent 55388afd
2009-12-18 Jason Merrill <jason@redhat.com> 2009-12-18 Jason Merrill <jason@redhat.com>
PR c++/28300
PR c++/42062
* pt.c (check_specialization_namespace): Complain about
specialization at non-namespace scope.
PR c++/42415 PR c++/42415
* call.c (build_new_method_call): Complain about calling the * call.c (build_new_method_call): Complain about calling the
constructor directly. constructor directly.
......
...@@ -742,6 +742,12 @@ check_specialization_namespace (tree tmpl) ...@@ -742,6 +742,12 @@ check_specialization_namespace (tree tmpl)
function, member class or static data member of a class template function, member class or static data member of a class template
shall be declared in the namespace of which the class template is shall be declared in the namespace of which the class template is
a member. */ a member. */
if (current_scope() != DECL_CONTEXT (tmpl)
&& !at_namespace_scope_p ())
{
error ("specialization of %qD must appear at namespace scope", tmpl);
return false;
}
if (is_associated_namespace (current_namespace, tpl_ns)) if (is_associated_namespace (current_namespace, tpl_ns))
/* Same or super-using namespace. */ /* Same or super-using namespace. */
return true; return true;
......
2009-12-18 Jason Merrill <jason@redhat.com> 2009-12-18 Jason Merrill <jason@redhat.com>
PR c++/28300
* g++.dg/template/spec37.C: New.
PR c++/42415 PR c++/42415
* g++.dg/tc1/dr147.C: Add test. * g++.dg/tc1/dr147.C: Add test.
......
// PR c++/28300
template<typename> struct A
{
template<typename T> struct A<T*>; // { dg-error "namespace scope" }
};
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