[clang] [Clang][RFC] Intrododuce a builtin to determine the structure binding size (PR #131515)

A. Jiang via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 16 10:00:52 PDT 2025


================
@@ -434,6 +434,36 @@ __datasizeof
 ``__datasizeof`` behaves like ``sizeof``, except that it returns the size of the
 type ignoring tail padding.
 
+.. _builtin_structured_binding_size-doc:
+
+__builtin_structured_binding_size (C++)
+---------------------------------------
+``__builtin_structured_binding_size`` returns the *structured binding size*
+([dcl.struct.bind]) of the type ``T`` (or unevaluate expression ``arg``)
+passed as argument.
+
+This is equivalent to the size of the pack ``p`` in ``auto&& [...p] = arg;``.
+If the argument is not destructurable (ie not an array, vector, complex,
----------------
frederick-vs-ja wrote:

I guess we should mention built-in array here.

https://github.com/llvm/llvm-project/pull/131515


More information about the cfe-commits mailing list