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

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 2 17:58:54 PDT 2026


shafik 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

Something like that, I asked b/c I noticed EDG does diagnose: https://godbolt.org/z/7KhchGojW

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


More information about the cfe-commits mailing list