aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/ByteCode/Interp.cpp
diff options
context:
space:
mode:
authorTimm Baeder <tbaeder@redhat.com>2025-05-22 14:26:52 +0200
committerGitHub <noreply@github.com>2025-05-22 14:26:52 +0200
commitd45f1d08272ead39700d54dc800ce78d97170bde (patch)
tree989bb134e4d4968f2233640d0211ca7e1e541e39 /clang/lib/AST/ByteCode/Interp.cpp
parent34a55c937673c67e634e018af40c0c569c5a2b79 (diff)
downloadllvm-d45f1d08272ead39700d54dc800ce78d97170bde.zip
llvm-d45f1d08272ead39700d54dc800ce78d97170bde.tar.gz
llvm-d45f1d08272ead39700d54dc800ce78d97170bde.tar.bz2
[clang][bytecode] Fix self-init diagnostics in C++23 (#141044)
Diffstat (limited to 'clang/lib/AST/ByteCode/Interp.cpp')
-rw-r--r--clang/lib/AST/ByteCode/Interp.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/AST/ByteCode/Interp.cpp b/clang/lib/AST/ByteCode/Interp.cpp
index b3ac84c..7cc0d2a 100644
--- a/clang/lib/AST/ByteCode/Interp.cpp
+++ b/clang/lib/AST/ByteCode/Interp.cpp
@@ -670,7 +670,8 @@ bool CheckInitialized(InterpState &S, CodePtr OpPC, const Pointer &Ptr,
if (const auto *VD = Ptr.getDeclDesc()->asVarDecl();
VD && (VD->isConstexpr() || VD->hasGlobalStorage())) {
- if (!S.getLangOpts().CPlusPlus23 && VD == S.EvaluatingDecl) {
+ if (VD == S.EvaluatingDecl &&
+ !(S.getLangOpts().CPlusPlus23 && VD->getType()->isReferenceType())) {
if (!S.getLangOpts().CPlusPlus14 &&
!VD->getType().isConstant(S.getASTContext())) {
// Diagnose as non-const read.