[clang] [docs] Add "constexpr" or "consteval" to pseudo-declarations of builtins (PR #247014)

Chen Miao via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 29 22:58:11 PST 2026


================
@@ -3366,7 +3366,7 @@ calculates the offset (in bytes) to a given member of the given type.
 **Syntax**:
 
 ```c++
-size_t __builtin_offsetof(type-name, member-designator);
+consteval size_t __builtin_offsetof(type-name, member-designator);
----------------
ChenMiaoi wrote:

``` suggestion
constexpr size_t __builtin_offsetof(type-name, member-designator);
```

Could we use `constexpr` here? Clang also accepts a runtime array index in the member designator.

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


More information about the cfe-commits mailing list