diff --git a/clang-tools-extra/clang-tidy/misc/UnconventionalAssignOperatorCheck.cpp b/clang-tools-extra/clang-tidy/misc/UnconventionalAssignOperatorCheck.cpp --- a/clang-tools-extra/clang-tidy/misc/UnconventionalAssignOperatorCheck.cpp +++ b/clang-tools-extra/clang-tidy/misc/UnconventionalAssignOperatorCheck.cpp @@ -73,9 +73,14 @@ if (const auto *RetStmt = Result.Nodes.getNodeAs("returnStmt")) { diag(RetStmt->getBeginLoc(), "operator=() should always return '*this'"); } else { + const ASTContext *ASTCtx = Result.Context; + const LangOptions &Opts = ASTCtx->getLangOpts(); static const char *const Messages[][2] = { {"ReturnType", "operator=() should return '%0&'"}, - {"ArgumentType", "operator=() should take '%0 const&', '%0&&' or '%0'"}, + {"ArgumentType", + Opts.CPlusPlus11 + ? "operator=() should take '%0 const&', '%0&&' or '%0'" + : "operator=() should take '%0 const&' or '%0'"}, {"cv", "operator=() should not be marked '%1'"}}; const auto *Method = Result.Nodes.getNodeAs("method");