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: 1 addition & 1 deletion clang/lib/AST/ByteCode/Interp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ bool CheckFinalLoad(InterpState &S, CodePtr OpPC, const Pointer &Ptr) {
}

bool CheckStore(InterpState &S, CodePtr OpPC, const Pointer &Ptr) {
if (!Ptr.isBlockPointer())
if (!Ptr.isBlockPointer() || Ptr.isZero())
return false;

if (!Ptr.block()->isAccessible()) {
Expand Down
5 changes: 5 additions & 0 deletions clang/test/AST/ByteCode/cxx23.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ constexpr int k(int n) {
}
constexpr int k0 = k(0);

namespace ThreadLocalStore {
thread_local int &&a = 0;
void store() { a = 42; }
}

#if __cplusplus >= 202302L
constexpr int &b = b; // all-error {{must be initialized by a constant expression}} \
// all-note {{initializer of 'b' is not a constant expression}} \
Expand Down
Loading