llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Timm Baeder (tbaederr)

<details>
<summary>Changes</summary>

We need to remove the pointer to the local variable we've created specifically 
for this complex binary operator.

Fixes https://github.com/llvm/llvm-project/issues/175670

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


2 Files Affected:

- (modified) clang/lib/AST/ByteCode/Compiler.cpp (+4) 
- (modified) clang/test/AST/ByteCode/complex.cpp (+4) 


``````````diff
diff --git a/clang/lib/AST/ByteCode/Compiler.cpp 
b/clang/lib/AST/ByteCode/Compiler.cpp
index b68576158decc..a67648aa2aff9 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -1381,6 +1381,10 @@ bool Compiler<Emitter>::VisitComplexBinOp(const 
BinaryOperator *E) {
     } else {
       if (!this->emitPop(ResultElemT, E))
         return false;
+      // Remove the Complex temporary pointer we created ourselves at the
+      // beginning of this function.
+      if (!Initializing)
+        return this->emitPopPtr(E);
     }
   }
   return true;
diff --git a/clang/test/AST/ByteCode/complex.cpp 
b/clang/test/AST/ByteCode/complex.cpp
index 182162d251ece..41e5dc0605c23 100644
--- a/clang/test/AST/ByteCode/complex.cpp
+++ b/clang/test/AST/ByteCode/complex.cpp
@@ -434,5 +434,9 @@ namespace Discard {
   }
   static_assert(test3() == 10, ""); // both-error {{not an integral constant 
expression}}
 
+  constexpr void V() {
+    (void)(1 + 2i);
+  }
+  static_assert((V(), true));
 
 }

``````````

</details>


https://github.com/llvm/llvm-project/pull/175709
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to