#include "UseEqualsDefaultCheck.h"
#include "../utils/LexerUtils.h"
+#include "../utils/Matchers.h"
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Lex/Lexer.h"
// isCopyAssignmentOperator() allows the parameter to be
// passed by value, and in this case it cannot be
// defaulted.
- hasParameter(0, hasType(lValueReferenceType())))
+ hasParameter(0, hasType(lValueReferenceType())),
+ // isCopyAssignmentOperator() allows non lvalue reference
+ // return types, and in this case it cannot be defaulted.
+ returns(qualType(hasCanonicalType(
+ allOf(lValueReferenceType(pointee(type())),
+ unless(matchers::isReferenceToConst()))))))
.bind(SpecialFunction),
this);
}
check.
The check now skips unions since in this case a default constructor with empty body
- is not equivalent to the explicitly defaulted one. The check is restricted to c++11-or-later.
+ is not equivalent to the explicitly defaulted one. The check also skips copy assignment
+ operators with nonstandard return types. The check is restricted to c++11-or-later.
Removed checks
^^^^^^^^^^^^^^