[clang] [clang][ExprConst] Allow mutation in `__builtin_constant_p`'s argument (PR #159599)

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 18 10:55:50 PDT 2025


https://github.com/shafik commented:

I think I would feel more comfortable if there was a justification of why this is allowed. 

Looking at the [documentation](https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html#index-_005f_005fbuiltin_005fconstant_005fp) they talk about "constant folding" and I know we diverge from gcc in a some ways here. 

It also says "Any expression that has side-effects makes the function return 0" which seems inconsistent w/ this behavior. 

Offline someone was saying the behavior has changed a few times on gcc's side and I don't want to be targeting a moving target without some more discussions about this.

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


More information about the cfe-commits mailing list