Skip to content

Commit c5d5972

Browse files
authored
[clang][bytecode] Reject constexpr-unknown values in CheckStore (#136279)
1 parent 1d19006 commit c5d5972

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

clang/lib/AST/ByteCode/Interp.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,8 @@ bool CheckStore(InterpState &S, CodePtr OpPC, const Pointer &Ptr) {
790790
return false;
791791
if (!CheckConst(S, OpPC, Ptr))
792792
return false;
793+
if (!S.inConstantContext() && isConstexprUnknown(Ptr))
794+
return false;
793795
return true;
794796
}
795797

clang/test/CodeGen/p0963r3.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %clang_cc1 -std=c++2c -verify -emit-llvm -triple=x86_64-pc-linux-gnu %s -o - | FileCheck %s
2-
// RUN: %clang_cc1 -std=c++2c -verify -fsyntax-only -fexperimental-new-constant-interpreter -triple=x86_64-pc-linux-gnu %s
1+
// RUN: %clang_cc1 -std=c++2c -verify -emit-llvm -triple=x86_64-pc-linux-gnu %s -o - | FileCheck %s
2+
// RUN: %clang_cc1 -std=c++2c -verify -emit-llvm -triple=x86_64-pc-linux-gnu %s -o - -fexperimental-new-constant-interpreter | FileCheck %s
33
// expected-no-diagnostics
44

55
namespace std {

0 commit comments

Comments
 (0)