[clang] [Clang][Sema] Make _Imag int/float LValue not assignable (PR #218270)

Amr Hesham via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 2 09:07:21 PDT 2026


AmrDeveloper wrote:

> It feels a bit wonky that this is only an error on assignment. The gcc docs are not particularly informative here: https://gcc.gnu.org/onlinedocs/gcc/Complex.html
> 
> I think I would have liked to see a diagnostic saying "hey you are using **imag** with a non complex type"

I guess you mean something like "__imag operator with non-complex type is not assignable" because it's only invalid as an lvalue but valid as an rvalue that will return zero

https://godbolt.org/z/nnKh4c3YY

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


More information about the cfe-commits mailing list