1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Bug 383706 - Class member initialization checker produces false

positives on deleted constructors
This commit is contained in:
Sergey Prigogin 2012-06-27 18:03:44 -07:00
parent f0d78b9761
commit 4e99b5aea4
2 changed files with 12 additions and 0 deletions

View file

@ -248,6 +248,8 @@ public class ClassMembersInitializationChecker extends AbstractIndexAstChecker {
private ICPPConstructor getConstructor(IASTDeclaration decl) {
if (decl instanceof ICPPASTFunctionDefinition) {
ICPPASTFunctionDefinition functionDefinition = (ICPPASTFunctionDefinition) decl;
// if (functionDefinition.isDeleted())
// return null;
IBinding binding = functionDefinition.getDeclarator().getName().resolveBinding();
if (binding instanceof ICPPConstructor) {
ICPPConstructor constructor = (ICPPConstructor) binding;

View file

@ -314,6 +314,16 @@ public class ClassMembersInitializationCheckerTest extends CheckerTestCase {
checkNoErrors();
}
// class C {
// public:
// C(const C& c) = delete;
// int i1, i2;
// };
public void testNoErrorsOnDeletedConstructor() {
loadCodeAndRun(getAboveComment());
checkNoErrors();
}
// void func(int & a) { a = 0; }
// class C {
// C() { func(i); } // No warnings.