Commit a544998e by Paolo Carlini Committed by Paolo Carlini

re PR c++/25666 (Bad diagnostic for templated destructor as friend)

/cp
2013-05-25  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/25666
	* decl2.c (check_classfn): Check for destructors declared as member
	templates.

/testsuite
2013-05-25  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/25666
	* g++.dg/parse/dtor16.C: New.
	* g++.dg/parse/dtor6.C: Adjust.

From-SVN: r199324
parent a62e8b4a
2013-05-25 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/25666
* decl2.c (check_classfn): Check for destructors declared as member
templates.
2013-05-24 Jason Merrill <jason@redhat.com> 2013-05-24 Jason Merrill <jason@redhat.com>
PR c++/56971 PR c++/56971
......
...@@ -646,6 +646,15 @@ check_classfn (tree ctype, tree function, tree template_parms) ...@@ -646,6 +646,15 @@ check_classfn (tree ctype, tree function, tree template_parms)
/* OK, is this a definition of a member template? */ /* OK, is this a definition of a member template? */
is_template = (template_parms != NULL_TREE); is_template = (template_parms != NULL_TREE);
/* [temp.mem]
A destructor shall not be a member template. */
if (DECL_DESTRUCTOR_P (function) && is_template)
{
error ("destructor %qD declared as member template", function);
return error_mark_node;
}
/* We must enter the scope here, because conversion operators are /* We must enter the scope here, because conversion operators are
named by target type, and type equivalence relies on typenames named by target type, and type equivalence relies on typenames
resolving within the scope of CTYPE. */ resolving within the scope of CTYPE. */
......
2013-05-25 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/25666
* g++.dg/parse/dtor16.C: New.
* g++.dg/parse/dtor6.C: Adjust.
2013-05-24 Paolo Carlini <paolo.carlini@oracle.com> 2013-05-24 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/19618 PR c++/19618
......
// PR c++/25666
struct A { ~A(); };
struct B
{
template<int> friend A::~A(); // { dg-error "member template" }
};
// PR c++/25638 // PR c++/25638
struct A { ~A(); }; // { dg-error "candidate" } struct A { ~A(); };
struct B : A struct B : A
{ {
template<int> friend A::~A(); // { dg-error "match" } template<int> friend A::~A(); // { dg-error "member template" }
}; };
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