Issue 164985
Summary [clang][bytecode] Clang produces incorrect mutable lambda code in presence of `-fexperimental-new-constant-interpreter`
Labels clang
Assignees
Reporter BobIsOnFire
    Minimal repro:

```cpp
#include <iostream>

int main() {
    auto foo = [a = false]() mutable {
        if (a) std::cout << ',';
        a = true;
 std::cout << 'A';
    };

    foo();
 foo();
}

```

https://godbolt.org/z/6nn4z4eqM

Looks like when `-fexperimental-new-constant-interpreter` is set, `if (a)` condition is optimized away completely, and `-Wunreachable-code` warning is emitted.

Didn't find anything similar in "clang:bytecode" open issues, but feel free to close if this is a duplicate.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to