[clang] [Clang][Sema] Make _Imag int/float LValue not assignable (PR #218270)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 3 07:11:10 PDT 2026
================
@@ -298,12 +298,18 @@ static Cl::Kinds ClassifyInternal(ASTContext &Ctx, const Expr *E) {
// expressions: l-value only if the operand is a true l-value.
case UO_Real:
case UO_Imag: {
- const Expr *Op = cast<UnaryOperator>(E)->getSubExpr()->IgnoreParens();
+ const auto *UnaryOp = cast<UnaryOperator>(E);
+ const Expr *Op = UnaryOp->getSubExpr()->IgnoreParens();
Cl::Kinds K = ClassifyInternal(Ctx, Op);
if (K != Cl::CL_LValue) return K;
if (isa<ObjCPropertyRefExpr>(Op))
return Cl::CL_SubObjCPropertySetting;
+
+ // _Imag with non-complex operand is not a valid l-value
----------------
AaronBallman wrote:
```suggestion
// _Imag with non-complex operand is not a valid l-value.
```
https://github.com/llvm/llvm-project/pull/218270
More information about the cfe-commits
mailing list