================
@@ -1009,3 +1010,59 @@ struct S {
} // expected-note {{later used here}}
};
} // namespace CapturedByThis
+
+// Implicit uses at scope exit (destructors, cleanup callbacks) have no use
+// expression.
+namespace implicit_use_join {
+void view_and_callable() {
+ std::string text = "long enough heap-allocated backing string value here!";
+ std::string_view tok = text;
+ std::function<void()> c = [] {};
+ (void)c;
+ (void)tok.size();
+}
+
+void view_and_callable_mutation() {
+ std::string text = "long enough heap-allocated backing string value here!";
+ std::string_view tok = text; // expected-warning {{local variable 'text' is
later invalidated}}
+ std::function<void()> c = [] {};
+ (void)c;
+ text.push_back('x'); // expected-note {{local variable 'text' is invalidated
here}}
+ (void)tok.size(); // expected-note {{later used here}}
+}
----------------
Xazax-hun wrote:
Oh, indeed. These tests are gone, they didn't do anything.
https://github.com/llvm/llvm-project/pull/204650
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits