forked from OSchip/llvm-project
[Sema] Disallow __make_integer_seq from showing up in __make_integer_seq
We hit over stringent asserts when trying to diagnose. Loosen them as appropriate. This fixes PR28494. llvm-svn: 275047
This commit is contained in:
parent
7ee070e7bc
commit
f580dd98cb
|
@ -5378,11 +5378,13 @@ bool Sema::CheckTemplateArgument(TemplateTemplateParmDecl *Param,
|
|||
if (!isa<ClassTemplateDecl>(Template) &&
|
||||
!isa<TemplateTemplateParmDecl>(Template) &&
|
||||
!isa<TypeAliasTemplateDecl>(Template)) {
|
||||
assert(isa<FunctionTemplateDecl>(Template) &&
|
||||
"Only function templates are possible here");
|
||||
assert((isa<FunctionTemplateDecl>(Template) ||
|
||||
isa<BuiltinTemplateDecl>(Template)) &&
|
||||
"Only function or builtin templates are possible here");
|
||||
Diag(Arg.getLocation(), diag::err_template_arg_not_valid_template);
|
||||
Diag(Template->getLocation(), diag::note_template_arg_refers_here_func)
|
||||
<< Template;
|
||||
if (isa<FunctionTemplateDecl>(Template))
|
||||
Diag(Template->getLocation(), diag::note_template_arg_refers_here_func)
|
||||
<< Template;
|
||||
}
|
||||
|
||||
TemplateParameterList *Params = Param->getTemplateParameters();
|
||||
|
|
|
@ -47,3 +47,7 @@ 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}}
|
||||
// expected-note@make_integer_seq.cpp:* {{template parameter has a different kind}}
|
||||
// expected-note@make_integer_seq.cpp:* {{previous template template parameter is here}}
|
||||
|
|
Loading…
Reference in New Issue