[clang] [clang][dataflow] fix assert in `Environment::getResultObjectLocation` (PR #79608)

via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 30 11:44:11 PST 2024


================
@@ -2735,6 +2735,41 @@ TEST(TransferTest, ResultObjectLocationForDefaultInitExpr) {
       });
 }
 
+// This test ensures that CXXOperatorCallExpr returning prvalues are correctly
+// handled by the transfer functions, especially that `getResultObjectLocation`
+// correctly returns a storage location for those.
+TEST(TransferTest, ResultObjectLocationForCXXOperatorCallExpr) {
+  std::string Code = R"(
+    struct A {
+      virtual ~A() = default;
+      A operator+(int a) { return A(); }
----------------
martinboehme wrote:

You don't need to provide the implementation.

```suggestion
      A operator+(int);
```

https://github.com/llvm/llvm-project/pull/79608


More information about the cfe-commits mailing list