================
@@ -1814,3 +1814,46 @@ namespace GH62206 {
     (d) = b; // Should not warn
   }
 } // namespace GH62206
+
+namespace GH63202 {
+
+struct Person {
+  std::string name;
+  Person() = default;
+  Person(Person&&) = default;
+  Person& operator=(Person&&) = default;
+};
+
+struct SpecialPerson : Person {
+  std::string surname;
+
+  // Valid: partial move
+  SpecialPerson(SpecialPerson&& sp)
+    : Person(std::move(sp)), surname(std::move(sp.surname)) {}
+
+  // Valid: partial forward — case fixed by this patch
+  SpecialPerson(SpecialPerson&& sp, int)
+    : Person(std::forward<Person>(sp)), surname(std::move(sp.surname)) {}
+
+  // Invalid: access base class member after base move
+  SpecialPerson(SpecialPerson&& sp, char)
+    : Person(std::move(sp)), surname(std::move(sp.name))
+    // CHECK-NOTES: [[@LINE-1]]:48: warning: 'sp' used after it was moved 
[bugprone-use-after-move]
----------------
voyager-jhk wrote:

> It isn't used anywhere in test file like this. From my experience, AI loves 
> putting full diagnostic lines in test like this in tests. If you use AI to 
> write these tests - please disclose it in PR description per 
> https://llvm.org/docs/AIToolPolicy.html.

Yes, I used AI to check my test formatting, and it said appending those 
diagnostic suffixes was the 'standard' way. I should have manually verified it 
against the surrounding tests.

I'll removed them, and update the PR description.

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

Reply via email to