diff options
author | Timm Baeder <tbaeder@redhat.com> | 2025-05-22 14:26:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-05-22 14:26:52 +0200 |
commit | d45f1d08272ead39700d54dc800ce78d97170bde (patch) | |
tree | 989bb134e4d4968f2233640d0211ca7e1e541e39 /clang/lib/AST/ByteCode/Interp.cpp | |
parent | 34a55c937673c67e634e018af40c0c569c5a2b79 (diff) | |
download | llvm-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.cpp | 3 |
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. |