llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Timm Baeder (tbaederr)

<details>
<summary>Changes</summary>

This is the correct function to use and it will create a variable scope.

Fixes #<!-- -->152822

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


2 Files Affected:

- (modified) clang/lib/AST/ByteCode/EvalEmitter.cpp (+1-1) 
- (modified) clang/test/AST/ByteCode/functions.cpp (+5) 


``````````diff
diff --git a/clang/lib/AST/ByteCode/EvalEmitter.cpp 
b/clang/lib/AST/ByteCode/EvalEmitter.cpp
index 9ed61c7b0be78..ecd42012987d4 100644
--- a/clang/lib/AST/ByteCode/EvalEmitter.cpp
+++ b/clang/lib/AST/ByteCode/EvalEmitter.cpp
@@ -98,7 +98,7 @@ bool EvalEmitter::interpretCall(const FunctionDecl *FD, const 
Expr *E) {
     this->Params.insert({PD, {0, false}});
   }
 
-  if (!this->visit(E))
+  if (!this->visitExpr(E, /*DestroyToplevelScope=*/true))
     return false;
   PrimType T = Ctx.classify(E).value_or(PT_Ptr);
   return this->emitPop(T, E);
diff --git a/clang/test/AST/ByteCode/functions.cpp 
b/clang/test/AST/ByteCode/functions.cpp
index 36e7bb32b2d86..0a38122df4fc8 100644
--- a/clang/test/AST/ByteCode/functions.cpp
+++ b/clang/test/AST/ByteCode/functions.cpp
@@ -708,3 +708,8 @@ namespace NoDiags {
     return true;
   }
 }
+
+namespace EnableIfWithTemporary {
+  struct A { ~A(); };
+  int &h() __attribute__((enable_if((A(), true), "")));
+}

``````````

</details>


https://github.com/llvm/llvm-project/pull/152857
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to