[clang] [clang] Improved diagnostics for explicit specialization/instantiation of closure type members (PR #192843)
Timm Baeder via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 29 02:30:12 PDT 2026
================
@@ -16331,10 +16331,13 @@ Decl *Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, Decl *D,
// have the LSI properly restored.
if (isGenericLambdaCallOperatorSpecialization(FD)) {
// C++2c 7.5.5.2p17 A member of a closure type shall not be explicitly
- // instantiated, explicitly specialized.
- if (FD->getTemplateSpecializationInfo()
- ->isExplicitInstantiationOrSpecialization()) {
- Diag(FD->getLocation(), diag::err_lambda_explicit_spec);
+ // specialized.
+ if (FD->getTemplateSpecializationInfo()->isExplicitSpecialization()) {
+ Diag(FD->getLocation(), diag::err_lambda_explicit_temp_spec)
+ << /*specialization*/ 0;
+ CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(FD->getParent());
----------------
tbaederr wrote:
This either needs to be `cast<>` or you need to check the result for `nullptr`.
https://github.com/llvm/llvm-project/pull/192843
More information about the cfe-commits
mailing list