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

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 18 07:54:53 PDT 2025


================
@@ -1911,6 +1911,38 @@ A simplistic usage example as might be seen in standard C++ headers follows:
   // Emulate type trait for compatibility with other compilers.
   #endif
 
+
+.. _builtin_structured_binding_size-doc:
+
+__builtin_structured_binding_size (C++)
+---------------------------------------
+
+The ``__builtin_structured_binding_size(T)`` type trait returns
+the *structured binding size* ([dcl.struct.bind]) of type ``T``
+
+This is equivalent to the size of the pack ``p`` in ``auto&& [...p] = declval<T&>();``.
+If the argument cannot be decomposed (ie not a builtin array, builtin SIMD vector,
----------------
shafik wrote:

I feel a bullet list would be better here. Also a positive form would read better, the following can be decomposed, otherwise it is not well-formed something like that.

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


More information about the cfe-commits mailing list