[clang] [Clang] Introduce __builtin_is_modifiable_lvalue() (PR #132524)

A. Jiang via cfe-commits cfe-commits at lists.llvm.org
Sat Mar 22 01:35:16 PDT 2025


================
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -std=c99 -fsyntax-only -verify %s
+
----------------
frederick-vs-ja wrote:

Would it make more sense to use `_Static_assert(__builtin_is_modifiable_lvalue(...), "")`?

Also, I think it would be valuable to cover more types.

N1570 6.3.2.1/1, N3467 6.3.3.1/1:
> [...] A _modifiable lvalue_ is an lvalue that does not have array type, does not have an incomplete type, does not have a const-qualified type, and if it is a structure or union, does not have any member (including, recursively, any member or element of all contained aggregates or unions) with a const-qualified type.

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


More information about the cfe-commits mailing list