[clang-tools-extra] [clang-tidy] Fix performance-noexcept-move-constructor for implicit noexcept(false) (PR #226488)

via cfe-commits cfe-commits at lists.llvm.org
Sun Sep 27 05:13:16 PDT 2026


================
@@ -181,6 +183,25 @@ struct O : virtual IntWrapper, ThrowOnAnything {
   // CHECK-FIXES: O &operator=(O &&)  noexcept = default;
 };
 
+struct P {
+  P() = default;
+
+  P(P &&) = default;
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: move constructors should be marked noexcept [performance-noexcept-move-constructor]
+  // CHECK-FIXES: P(P &&)  noexcept = default;
+  P &operator=(P &&) = default;
----------------
cpp-engine wrote:

Hi! 
Thanks for reviewing my PRs. 

I checked, and the test was indeed not quite right. Here is an example that better illustrates the problem:
https://godbolt.org/z/oxEj8hbKs

However, after doing some additional local checks, I realized that I hadn’t yet fixed another case from my task involving std::vector<std::string>:
https://godbolt.org/z/16v7ec4q1

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


More information about the cfe-commits mailing list