Index: clang-tools-extra/clang-tidy/readability/ConstReturnTypeCheck.cpp =================================================================== --- clang-tools-extra/clang-tidy/readability/ConstReturnTypeCheck.cpp +++ clang-tools-extra/clang-tidy/readability/ConstReturnTypeCheck.cpp @@ -97,7 +97,9 @@ // Find all function definitions for which the return types are `const` // qualified. Finder->addMatcher( - functionDecl(returns(isConstQualified()), isDefinition()).bind("func"), + functionDecl(returns(isConstQualified()), + anyOf(isDefinition(), cxxMethodDecl(isPure()))) + .bind("func"), this); } Index: clang-tools-extra/test/clang-tidy/checkers/readability-const-return-type.cpp =================================================================== --- clang-tools-extra/test/clang-tidy/checkers/readability-const-return-type.cpp +++ clang-tools-extra/test/clang-tidy/checkers/readability-const-return-type.cpp @@ -271,3 +271,17 @@ int **const * n_multiple_ptr(); int *const & n_pointer_ref(); + +class PVBase { +public: + virtual const int getC() = 0; + // CHECK-MESSAGES: [[@LINE-1]]:3: warning: return type 'const int' is 'const'-qualified at the top level, which may reduce code readability without improving const correctness + // CHECK-FIXES: virtual int getC() = 0; +}; + +class PVDerive : public PVBase { +public: + const int getC() { return 1; } + // CHECK-MESSAGES: [[@LINE-1]]:3: warning: return type 'const int' is 'const'-qualified at the top level, which may reduce code readability without improving const correctness + // CHECK-FIXES: int getC() { return 1; } +};