def note_destructor_type_here : Note<
"type %0 is declared here">;
+def err_destructor_template : Error<
+ "destructor cannot be declared as a template">;
+
// C++ initialization
def err_init_conversion_failed : Error<
"cannot initialize %select{a variable|a parameter|return object|an "
// determine whether we have a template or a template specialization.
bool Invalid = false;
if (TemplateParameterList *TemplateParams
- = MatchTemplateParametersToScopeSpecifier(
+ = MatchTemplateParametersToScopeSpecifier(
D.getDeclSpec().getSourceRange().getBegin(),
D.getCXXScopeSpec(),
TemplateParamLists.get(),
if (CheckTemplateDeclScope(S, TemplateParams))
return 0;
+ // A destructor cannot be a template.
+ if (Name.getNameKind() == DeclarationName::CXXDestructorName) {
+ Diag(NewFD->getLocation(), diag::err_destructor_template);
+ return 0;
+ }
+
+
FunctionTemplate = FunctionTemplateDecl::Create(Context, DC,
NewFD->getLocation(),
Name, TemplateParams,
}
namespace rdar8529993 {
-struct A { ~A(); }; // expected-note {{nearly matches}}
+struct A { ~A(); };
struct B : A
{
- template<int> friend A::~A(); // expected-error {{does not match}}
+ template<int> friend A::~A(); // expected-error {{destructor cannot be declared as a template}}
};
}