diff --git a/clang-tools-extra/clang-tidy/readability/NamedParameterCheck.cpp b/clang-tools-extra/clang-tidy/readability/NamedParameterCheck.cpp --- a/clang-tools-extra/clang-tidy/readability/NamedParameterCheck.cpp +++ b/clang-tools-extra/clang-tidy/readability/NamedParameterCheck.cpp @@ -28,7 +28,7 @@ // overriden method. const FunctionDecl *Definition = nullptr; if ((!Function->isDefined(Definition) || Function->isDefaulted() || - Function->isDeleted()) && + Definition->isDefaulted() || Function->isDeleted()) && (!isa(Function) || cast(Function)->size_overridden_methods() == 0)) return; diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst --- a/clang-tools-extra/docs/ReleaseNotes.rst +++ b/clang-tools-extra/docs/ReleaseNotes.rst @@ -396,6 +396,10 @@ ` check when warning would be unnecessarily emitted for template dependent ``if constexpr``. +- Fixed a false positive in :doc:`readability-named-parameter + ` for defaulted out-of-line + special member functions. + - Fixed incorrect fixes in :doc:`readability-redundant-declaration ` check when linkage (like ``extern "C"``) is explicitly specified. diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/named-parameter.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/named-parameter.cpp --- a/clang-tools-extra/test/clang-tidy/checkers/readability/named-parameter.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/readability/named-parameter.cpp @@ -131,3 +131,20 @@ typedef void (F)(int); F f; void f(int x) {} + +namespace issue_63056 +{ + struct S { + S(const S&); + S(S&&); + + S& operator=(const S&); + S& operator=(S&&); + }; + + S::S(const S&) = default; + S::S(S&&) = default; + + S& S::operator=(const S&) = default; + S& S::operator=(S&&) = default; +} // namespace issue_63056