diff --git a/clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.h b/clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.h index a992177522f75b..4ffed8c406481d 100644 --- a/clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.h +++ b/clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.h @@ -38,7 +38,7 @@ class UseEqualsDefaultCheck : public ClangTidyCheck { public: UseEqualsDefaultCheck(StringRef Name, ClangTidyContext *Context); bool isLanguageVersionSupported(const LangOptions &LangOpts) const override { - return LangOpts.CPlusPlus; + return LangOpts.CPlusPlus11; } void storeOptions(ClangTidyOptions::OptionMap &Opts) override; void registerMatchers(ast_matchers::MatchFinder *Finder) override; diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst index 55c8c341bff3af..e0907b23c84c71 100644 --- a/clang-tools-extra/docs/ReleaseNotes.rst +++ b/clang-tools-extra/docs/ReleaseNotes.rst @@ -145,7 +145,7 @@ Changes in existing checks check. The check now skips unions since in this case a default constructor with empty body - is not equivalent to the explicitly defaulted one. + is not equivalent to the explicitly defaulted one. The check is restricted to c++11-or-later. Removed checks ^^^^^^^^^^^^^^ diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-equals-default-cxx98.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-equals-default-cxx98.cpp new file mode 100644 index 00000000000000..d43c1e58c26063 --- /dev/null +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-equals-default-cxx98.cpp @@ -0,0 +1,8 @@ +// RUN: %check_clang_tidy -std=c++98 %s modernize-use-equals-default %t + +struct S { + S() {} + // CHECK-FIXES: S() {} + ~S() {} + // CHECK-FIXES: ~S() {} +};