diff --git a/clang-tools-extra/clang-tidy/google/ExplicitConstructorCheck.cpp b/clang-tools-extra/clang-tidy/google/ExplicitConstructorCheck.cpp index ca81de1dcd2e..1257d100d3d5 100644 --- a/clang-tools-extra/clang-tidy/google/ExplicitConstructorCheck.cpp +++ b/clang-tools-extra/clang-tidy/google/ExplicitConstructorCheck.cpp @@ -26,8 +26,11 @@ void ExplicitConstructorCheck::registerMatchers(MatchFinder *Finder) { return; Finder->addMatcher(cxxConstructorDecl(unless(isInstantiated())).bind("ctor"), this); - Finder->addMatcher(cxxConversionDecl(unless(isExplicit())).bind("conversion"), - this); + Finder->addMatcher( + cxxConversionDecl(unless(isExplicit()), // Already marked explicit. + unless(isImplicit())) // Compiler-generated. + .bind("conversion"), + this); } // Looks for the token matching the predicate and returns the range of the found diff --git a/clang-tools-extra/test/clang-tidy/google-explicit-constructor.cpp b/clang-tools-extra/test/clang-tidy/google-explicit-constructor.cpp index f8a154e559dd..6cc3435b9b88 100644 --- a/clang-tools-extra/test/clang-tidy/google-explicit-constructor.cpp +++ b/clang-tools-extra/test/clang-tidy/google-explicit-constructor.cpp @@ -80,6 +80,10 @@ struct B { // CHECK-FIXES: {{^ }}B(::std::initializer_list &&list6) {} }; +struct StructWithFnPointer { + void (*f)(); +} struct_with_fn_pointer = {[] {}}; + using namespace std; struct C {