[PATCH] Sema: Remove dead code in CheckTemplateArgumentAddressOfObjectOrFunction

Eli Friedman eli.friedman at gmail.com
Sun Aug 18 18:03:20 PDT 2013


LGTM.

-Eli


On Sun, Aug 18, 2013 at 1:29 PM, David Majnemer <david.majnemer at gmail.com>wrote:

> Hi eli.friedman, doug.gregor,
>
> DeclRefExpr::getDecl gives us back a ValueDecl, this isa<> check will
> never fire.
>
> http://llvm-reviews.chandlerc.com/D1434
>
> Files:
>   include/clang/Basic/DiagnosticSemaKinds.td
>   lib/Sema/SemaTemplate.cpp
>
> Index: include/clang/Basic/DiagnosticSemaKinds.td
> ===================================================================
> --- include/clang/Basic/DiagnosticSemaKinds.td
> +++ include/clang/Basic/DiagnosticSemaKinds.td
> @@ -2952,9 +2952,6 @@
>    "ignores qualifiers">;
>  def err_template_arg_not_decl_ref : Error<
>    "non-type template argument does not refer to any declaration">;
> -def err_template_arg_not_object_or_func_form : Error<
> -  "non-type template argument does not directly refer to an object or "
> -  "function">;
>  def err_template_arg_not_address_of : Error<
>    "non-type template argument for template parameter of pointer type %0
> must "
>    "have its address taken">;
> Index: lib/Sema/SemaTemplate.cpp
> ===================================================================
> --- lib/Sema/SemaTemplate.cpp
> +++ lib/Sema/SemaTemplate.cpp
> @@ -4177,14 +4177,6 @@
>      return true;
>    }
>
> -  if (!isa<ValueDecl>(DRE->getDecl())) {
> -    S.Diag(Arg->getLocStart(),
> -           diag::err_template_arg_not_object_or_func_form)
> -      << Arg->getSourceRange();
> -    S.Diag(Param->getLocation(), diag::note_template_param_here);
> -    return true;
> -  }
> -
>    ValueDecl *Entity = DRE->getDecl();
>
>    // Cannot refer to non-static data members
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130818/3b1794de/attachment.html>


More information about the cfe-commits mailing list