[clang] [Clang][Sema] Do not perform type conversion before computing result type of `x ? : y` in C++ (PR #108837)

Yanzuo Liu via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 12 05:05:04 PST 2025


================
@@ -8785,14 +8785,11 @@ ExprResult Sema::ActOnConditionalOp(SourceLocation QuestionLoc,
       commonExpr = result.get();
     }
     // We usually want to apply unary conversions *before* saving, except
-    // in the special case of a C++ l-value conditional.
-    if (!(getLangOpts().CPlusPlus
-          && !commonExpr->isTypeDependent()
-          && commonExpr->getValueKind() == RHSExpr->getValueKind()
-          && commonExpr->isGLValue()
----------------
zwuis wrote:

> So I don't see how losing the above two value kind exceptions fix this? Can you explain this better?

I have updated the description of this PR. Please let me know if it isn't still clear enough.

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


More information about the cfe-commits mailing list