r275078 - [Sema] Don't artificially forbid BuiltinTemplateDecls in CheckTemplateArgument
David Majnemer via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 11 10:09:56 PDT 2016
Author: majnemer
Date: Mon Jul 11 12:09:56 2016
New Revision: 275078
URL: http://llvm.org/viewvc/llvm-project?rev=275078&view=rev
Log:
[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.
Modified:
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/test/SemaCXX/make_integer_seq.cpp
Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=275078&r1=275077&r2=275078&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Mon Jul 11 12:09:56 2016
@@ -5377,14 +5377,13 @@ bool Sema::CheckTemplateArgument(Templat
// 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();
Modified: cfe/trunk/test/SemaCXX/make_integer_seq.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/make_integer_seq.cpp?rev=275078&r1=275077&r2=275078&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/make_integer_seq.cpp (original)
+++ cfe/trunk/test/SemaCXX/make_integer_seq.cpp Mon Jul 11 12:09:56 2016
@@ -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 at make_integer_seq.cpp:* {{template parameter has a different kind}}
// expected-note at make_integer_seq.cpp:* {{previous template template parameter is here}}
More information about the cfe-commits
mailing list