diff options
| -rw-r--r-- | clang-tools-extra/clang-tidy/misc/VirtualNearMissCheck.cpp | 8 | ||||
| -rw-r--r-- | clang-tools-extra/test/clang-tidy/misc-virtual-near-miss.cpp | 1 |
2 files changed, 6 insertions, 3 deletions
diff --git a/clang-tools-extra/clang-tidy/misc/VirtualNearMissCheck.cpp b/clang-tools-extra/clang-tidy/misc/VirtualNearMissCheck.cpp index ba4655b16a8..d43ddfbac76 100644 --- a/clang-tools-extra/clang-tidy/misc/VirtualNearMissCheck.cpp +++ b/clang-tools-extra/clang-tidy/misc/VirtualNearMissCheck.cpp @@ -178,7 +178,8 @@ bool VirtualNearMissCheck::isPossibleToBeOverridden( bool IsPossible = !BaseMD->isImplicit() && !isa<CXXConstructorDecl>(BaseMD) && !isa<CXXDestructorDecl>(BaseMD) && BaseMD->isVirtual() && - !BaseMD->isOverloadedOperator(); + !BaseMD->isOverloadedOperator() && + !isa<CXXConversionDecl>(BaseMD); PossibleMap[Id] = IsPossible; return IsPossible; } @@ -210,8 +211,9 @@ void VirtualNearMissCheck::registerMatchers(MatchFinder *Finder) { return; Finder->addMatcher( - cxxMethodDecl(unless(anyOf(isOverride(), isImplicit(), - cxxConstructorDecl(), cxxDestructorDecl()))) + cxxMethodDecl( + unless(anyOf(isOverride(), isImplicit(), cxxConstructorDecl(), + cxxDestructorDecl(), cxxConversionDecl()))) .bind("method"), this); } diff --git a/clang-tools-extra/test/clang-tidy/misc-virtual-near-miss.cpp b/clang-tools-extra/test/clang-tidy/misc-virtual-near-miss.cpp index acc458c951c..7a4ae2a867e 100644 --- a/clang-tools-extra/test/clang-tidy/misc-virtual-near-miss.cpp +++ b/clang-tools-extra/test/clang-tidy/misc-virtual-near-miss.cpp @@ -69,6 +69,7 @@ public: int decaz(const char str[]); // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: method 'Child::decaz' has {{.*}} 'Mother::decay' + operator bool(); private: void funk(); // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: method 'Child::funk' has {{.*}} 'Father::func' |

