[clang] [Clang][RFC] Intrododuce a builtin to determine the structure binding size (PR #131515)
Younan Zhang via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 17 01:51:24 PDT 2025
================
@@ -4160,6 +4160,54 @@ static bool CheckVecStepTraitOperandType(Sema &S, QualType T,
return false;
}
+static ExprResult BuildStructuredBindingSizeTraitImpl(Sema &S, QualType T,
+ Expr *E,
+ TypeSourceInfo *TInfo,
+ SourceLocation Loc,
+ SourceRange ArgRange) {
+ assert(!!E != !!TInfo);
+ assert(!T->isDependentType());
+ std::optional<unsigned> Size =
+ S.GetDecompositionElementCount(T, ArgRange.getBegin());
+ if (!Size) {
+ return S.Diag(Loc, diag::err_arg_is_not_destructurable) << T << ArgRange;
----------------
zyn0217 wrote:
I meant there were 2 returns in this block. The first doesn't look right to me in this `ExprResult`-as-the-return-type scenario.
https://github.com/llvm/llvm-project/pull/131515
More information about the cfe-commits
mailing list