[clang] [clang][bytecode]Fix-constant-eval-complex-discard (PR #177731)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 23 20:51:50 PST 2026


================
@@ -7406,7 +7406,8 @@ bool Compiler<Emitter>::emitComplexComparison(const Expr *LHS, const Expr *RHS,
                                               const BinaryOperator *E) {
   assert(E->isComparisonOp());
   assert(!Initializing);
-  assert(!DiscardResult);
+  if (DiscardResult)
+    return true;
----------------
tbaederr wrote:

This is wrong if they operands have side-effects:
```c++
constexpr int foo() {

  int k = 0;
  1i == (++k,1i);

  return k;
}
static_assert(foo() == 1);
```

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


More information about the cfe-commits mailing list