[clang] [dataflow] CXXOperatorCallExpr equal operator might not be a glvalue (PR #80991)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 7 06:32:16 PST 2024
================
@@ -2313,6 +2313,42 @@ TEST(TransferTest, AssignmentOperatorWithInitAndInheritance) {
ASTContext &ASTCtx) {});
}
+TEST(TransferTest, CXXOperatorCallExprEqualReturnsVoid) {
+ // This is a crash repro.
+ std::string Code = R"(
+ struct B {
+ void operator=(B&& other);
+ };
+ void target() {
+ B b;
+ b = B();
+ // [[p]]
+ }
+ )";
+ runDataflow(
+ Code,
+ [](const llvm::StringMap<DataflowAnalysisState<NoopLattice>> &Results,
+ ASTContext &ASTCtx) {});
+}
+
+TEST(TransferTest, CXXOperatorCallExprEqualReturnsPRValue) {
----------------
martinboehme wrote:
```suggestion
TEST(TransferTest, AssignmentOperatorReturnsByValue) {
```
Nit: The `CallExpr` is a prvalue, but the assignment operator itself returns a value rather than a reference.
https://github.com/llvm/llvm-project/pull/80991
More information about the cfe-commits
mailing list