[clang] [Clang][Sema] Reject template arguments not equivalent to their copies (part of P2308R1) (PR #193754)
Yanzuo Liu via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 25 00:24:16 PDT 2026
================
@@ -7417,6 +7477,12 @@ ExprResult Sema::CheckTemplateArgument(NamedDecl *Param, QualType ParamType,
if (Value.isAddrLabelDiff())
return Diag(StartLoc, diag::err_non_type_template_arg_addr_label_diff);
+ if (ParamType->isRecordType() &&
+ !ParamType->isInstantiationDependentType() &&
----------------
zwuis wrote:
> https://github.com/llvm/llvm-project/blob/a6cf1aa076d240ca54797e47d9a45d3be6062829/clang/lib/AST/TemplateBase.cpp#L221-L225
>
> So I added this condition and the assertion in ASTContext.cpp.
IIUC you asked what happens if we turn these three `T->isInstantiationDependentType` to `T->isDependentType`. It causes regression on the test GH84052.
https://github.com/llvm/llvm-project/pull/193754
More information about the cfe-commits
mailing list