[PATCH] D150108: [clang] Evaluate non-type default template argument when it is required

Mariya Podchishchaeva via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 8 08:26:56 PDT 2023


Fznamznon added inline comments.


================
Comment at: clang/lib/Sema/SemaTemplate.cpp:1614
 
-    TemplateArgument SugaredConverted, CanonicalConverted;
-    ExprResult DefaultRes = CheckTemplateArgument(
----------------
shafik wrote:
> Out of curiosity where is the template argument being checked now and why does checking it early cause the failure?
After the patch template argument is checked when the template is instantiated, i.e. the check now happens together for the whole provided template argument list.
Early checking causes reject-valid problems when for example a function is forward declared, used in default template argument and then defined later but before the point of instantiation. With early check the error also would be emitted if default template argument was never used.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150108/new/

https://reviews.llvm.org/D150108



More information about the cfe-commits mailing list