Skip to content

Conversation

@tbaederr
Copy link
Contributor

... even when we're not performing a lvalue-to-rvalue conversion.

... even when we're not performing a lvalue-to-rvalue conversion.
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Jan 31, 2025
@llvmbot
Copy link
Member

llvmbot commented Jan 31, 2025

@llvm/pr-subscribers-clang

Author: Timm Baeder (tbaederr)

Changes

... even when we're not performing a lvalue-to-rvalue conversion.


Full diff: https://github.com/llvm/llvm-project/pull/125247.diff

1 Files Affected:

  • (modified) clang/lib/AST/ByteCode/EvalEmitter.cpp (+3)
diff --git a/clang/lib/AST/ByteCode/EvalEmitter.cpp b/clang/lib/AST/ByteCode/EvalEmitter.cpp
index 9763fe89b73742..8134bbf270363e 100644
--- a/clang/lib/AST/ByteCode/EvalEmitter.cpp
+++ b/clang/lib/AST/ByteCode/EvalEmitter.cpp
@@ -174,6 +174,9 @@ template <> bool EvalEmitter::emitRet<PT_Ptr>(const SourceInfo &Info) {
       return false;
     }
   } else {
+    if (!Ptr.isLive() && !Ptr.isTemporary())
+      return false;
+
     EvalResult.setValue(Ptr.toAPValue(Ctx.getASTContext()));
   }
 

@tbaederr tbaederr merged commit 6b8d076 into llvm:main Jan 31, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants