Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions clang/lib/AST/ByteCode/Interp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,8 @@ bool CheckLoad(InterpState &S, CodePtr OpPC, const Pointer &Ptr,
return false;
if (!CheckVolatile(S, OpPC, Ptr, AK))
return false;
if (!Ptr.isConst() && !S.inConstantContext() && isConstexprUnknown(Ptr))
return false;
return true;
}

Expand Down
15 changes: 15 additions & 0 deletions clang/test/AST/ByteCode/codegen-cxx20.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// RUN: %clang_cc1 -triple x86_64-linux -emit-llvm -o - %s -fcxx-exceptions | FileCheck %s
// RUN: %clang_cc1 -triple x86_64-linux -emit-llvm -o - %s -fcxx-exceptions -fexperimental-new-constant-interpreter | FileCheck %s


/// The read from a used to succeed, causing the entire if statement to vanish.
extern void e();
int somefunc() {
auto foo = [a = false]() mutable {
if (a)
e();
};
foo();
}

// CHECK: call void @_Z1ev()