forked from OSchip/llvm-project
[clang-tidy] Fix PR35468
Differential Revision: https://reviews.llvm.org/D46003 llvm-svn: 330719
This commit is contained in:
parent
497c70fff1
commit
2735166156
|
@ -24,9 +24,9 @@ void UnconventionalAssignOperatorCheck::registerMatchers(
|
||||||
if (!getLangOpts().CPlusPlus)
|
if (!getLangOpts().CPlusPlus)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const auto HasGoodReturnType = cxxMethodDecl(returns(
|
const auto HasGoodReturnType = cxxMethodDecl(returns(lValueReferenceType(
|
||||||
lValueReferenceType(pointee(unless(isConstQualified()),
|
pointee(unless(isConstQualified()),
|
||||||
hasDeclaration(equalsBoundNode("class"))))));
|
anyOf(autoType(), hasDeclaration(equalsBoundNode("class")))))));
|
||||||
|
|
||||||
const auto IsSelf = qualType(
|
const auto IsSelf = qualType(
|
||||||
anyOf(hasDeclaration(equalsBoundNode("class")),
|
anyOf(hasDeclaration(equalsBoundNode("class")),
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
// RUN: %check_clang_tidy %s misc-unconventional-assign-operator %t -- -- -std=c++17 -fno-delayed-template-parsing
|
||||||
|
|
||||||
|
struct BadModifier {
|
||||||
|
BadModifier& operator=(const BadModifier&) const;
|
||||||
|
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: operator=() should not be marked 'const'
|
||||||
|
};
|
||||||
|
|
||||||
|
struct PR35468 {
|
||||||
|
template<typename T> auto &operator=(const T &) {
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
};
|
Loading…
Reference in New Issue