Issue 126041
Summary [clang-tidy] performance-noexcept-move-constructor False Positive on =default'ed move SMFs
Labels clang-tidy
Assignees
Reporter marcmutz
    performance-noexcept-move-constructor incorrectly warns about code employs https://eel.is/c++draft/except.spec#6 `noexcept(auto)` behaviour for `=default`ed special member functions (SMFs):

```
class Base {
protected:
     ~Base() = default; // want this
     // need these because of recent Clang -Wdeprecated:
 Base(const Base &) = default;
     Base(Base &&) = default;             // warning: move ctors should be noexcept
     Base &operator=(const Base &) = default;
     Base &operator=(Base &&) = default;
     Base() = default;

     ~~~
};
```

In our case (https://codereview.qt-project.org/c/qt/qtbase/+/616627/comment/e32ef87f_2d0bf46b/), these `=default`s are coming from a macro, so we actively rely on [expect.spec]/6.

Expected behaviour: Clang-tidy either excludes `=default`ed SMFs from the analysis or (harder) actively calculates the noexcept specification for defaulted SMFs and only warns if the result is `false`.

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to