[clang] [clang] Decay types of function and constant template parameter packs (PR #132189)
Matheus Izvekov via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 24 06:37:02 PDT 2025
================
@@ -1277,19 +1278,27 @@ QualType Sema::CheckNonTypeTemplateParameterType(TypeSourceInfo *&TSI,
TSI = SubstAutoTypeSourceInfoDependent(TSI);
}
- return CheckNonTypeTemplateParameterType(TSI->getType(), Loc);
+ return CheckNonTypeTemplateParameterType(TSI->getType(), Loc, Diagnose);
}
-bool Sema::RequireStructuralType(QualType T, SourceLocation Loc) {
+bool Sema::RequireStructuralType(QualType T, SourceLocation Loc,
+ bool Diagnose) {
if (T->isDependentType())
return false;
- if (RequireCompleteType(Loc, T, diag::err_template_nontype_parm_incomplete))
+ if (Diagnose ? RequireCompleteType(Loc, T,
+ diag::err_template_nontype_parm_incomplete)
+ : !isCompleteType(Loc, T))
return true;
if (T->isStructuralType())
return false;
+ // If we're not emitting diagnostics, there's no need to figure out
+ // why exactly T is not a structural type.
+ if (!Diagnose)
+ return true;
----------------
mizvekov wrote:
I think this is not exactly true.
Down below, we would RequireLiteralType, which in turn will RequireCompleteType, which has side effects.
It can perform instantiations, lock down the inheritance model under MSVC, and so on.
https://github.com/llvm/llvm-project/pull/132189
More information about the cfe-commits
mailing list