================
@@ -3205,7 +3180,17 @@ LValue CIRGenFunction::emitConditionalOperatorLValue(
assert((info.lhs || info.rhs) &&
"both operands of glvalue conditional are throw-expressions?");
- return info.lhs ? *info.lhs : *info.rhs;
+
+ // Only one arm produced an lvalue; the other was a throw-expression. The
+ // surviving arm's pointer was materialized inside the ternary's region and
+ // is not visible past the op, so address the result through the ternary's
+ // result value, which the region's cir.yield carries out.
+ LValue &survivingLV = info.lhs ? *info.lhs : *info.rhs;
+ Address survivingAddr = survivingLV.getAddress();
+ Address result(info.result, survivingAddr.getElementType(),
+ survivingAddr.getAlignment());
+ assert(!cir::MissingFeatures::opTBAA());
+ return makeAddrLValue(result, expr->getType(), survivingLV.getBaseInfo());
----------------
andykaylor wrote:
Got it. That makes sense.
https://github.com/llvm/llvm-project/pull/210384
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits