summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang-tools-extra/clang-tidy/google/ExplicitConstructorCheck.cpp7
-rw-r--r--clang-tools-extra/test/clang-tidy/google-explicit-constructor.cpp4
2 files changed, 9 insertions, 2 deletions
diff --git a/clang-tools-extra/clang-tidy/google/ExplicitConstructorCheck.cpp b/clang-tools-extra/clang-tidy/google/ExplicitConstructorCheck.cpp
index ca81de1dcd2..1257d100d3d 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 f8a154e559d..6cc3435b9b8 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<char> &&list6) {}
};
+struct StructWithFnPointer {
+ void (*f)();
+} struct_with_fn_pointer = {[] {}};
+
using namespace std;
struct C {
OpenPOWER on IntegriCloud