]> granicus.if.org Git - clang/commitdiff
[Sema] Don't artificially forbid BuiltinTemplateDecls in CheckTemplateArgument
authorDavid Majnemer <david.majnemer@gmail.com>
Mon, 11 Jul 2016 17:09:56 +0000 (17:09 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Mon, 11 Jul 2016 17:09:56 +0000 (17:09 +0000)
After thinking about it, we don't really need to forbid
BuiltinTemplateDecls explicitly.  The restriction doesn't really buy us
anything.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@275078 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaTemplate.cpp
test/SemaCXX/make_integer_seq.cpp

index c1b6b5e45aeba83cc3d4aee6fba58a047093982a..8175df37ba17111cf6af3c9c1ae5c5c3c322f2cb 100644 (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();
index 0cab0cf6e763e6e8f6464375feaaeaf206151de9..a9b8d2b23cb50f48d81a0961efdbdc840250ae5d 100644 (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}}