[Sema] Don't artificially forbid BuiltinTemplateDecls in CheckTemplateArgument

After thinking about it, we don't really need to forbid
BuiltinTemplateDecls explicitly.  The restriction doesn't really buy us
anything.

llvm-svn: 275078
This commit is contained in:
David Majnemer 2016-07-11 17:09:56 +00:00
parent dd8f6bdd46
commit c2406d46b8
2 changed files with 7 additions and 8 deletions

View File

@ -5377,14 +5377,13 @@ bool Sema::CheckTemplateArgument(TemplateTemplateParmDecl *Param,
// partial specializations.
if (!isa<ClassTemplateDecl>(Template) &&
!isa<TemplateTemplateParmDecl>(Template) &&
!isa<TypeAliasTemplateDecl>(Template)) {
assert((isa<FunctionTemplateDecl>(Template) ||
isa<BuiltinTemplateDecl>(Template)) &&
"Only function or builtin templates are possible here");
!isa<TypeAliasTemplateDecl>(Template) &&
!isa<BuiltinTemplateDecl>(Template)) {
assert(isa<FunctionTemplateDecl>(Template) &&
"Only function templates are possible here");
Diag(Arg.getLocation(), diag::err_template_arg_not_valid_template);
if (isa<FunctionTemplateDecl>(Template))
Diag(Template->getLocation(), diag::note_template_arg_refers_here_func)
<< Template;
Diag(Template->getLocation(), diag::note_template_arg_refers_here_func)
<< Template;
}
TemplateParameterList *Params = Param->getTemplateParameters();

View File

@ -48,6 +48,6 @@ using illformed2 = ErrorSeq<int, -5>;
template <typename T, T N> void f() {}
__make_integer_seq<f, int, 0> x; // expected-error{{template template parameter must be a class template or type alias template}}
__make_integer_seq<__make_integer_seq, int, 10> PR28494; // expected-error{{does not refer to a class or alias template, or template template parameter}} expected-error{{different template parameters}}
__make_integer_seq<__make_integer_seq, int, 10> PR28494; // expected-error{{different template parameters}}
// expected-note@make_integer_seq.cpp:* {{template parameter has a different kind}}
// expected-note@make_integer_seq.cpp:* {{previous template template parameter is here}}