diff options
Diffstat (limited to 'clang-tools-extra/clang-tidy/google/ExplicitConstructorCheck.cpp')
-rw-r--r-- | clang-tools-extra/clang-tidy/google/ExplicitConstructorCheck.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/clang-tools-extra/clang-tidy/google/ExplicitConstructorCheck.cpp b/clang-tools-extra/clang-tidy/google/ExplicitConstructorCheck.cpp index d262f9fa89c..9552e1afa34 100644 --- a/clang-tools-extra/clang-tidy/google/ExplicitConstructorCheck.cpp +++ b/clang-tools-extra/clang-tidy/google/ExplicitConstructorCheck.cpp @@ -113,8 +113,12 @@ void ExplicitConstructorCheck::check(const MatchFinder::MatchResult &Result) { takesInitializerList) return; + bool SingleArgument = + Ctor->getNumParams() == 1 && !Ctor->getParamDecl(0)->isParameterPack(); SourceLocation Loc = Ctor->getLocation(); - diag(Loc, "single-argument constructors must be explicit") + diag(Loc, SingleArgument ? "single-argument constructors must be explicit" + : "constructors that are callable with a single " + "argument must be marked explicit") << FixItHint::CreateInsertion(Loc, "explicit "); } |