mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 383706 - Class member initialization checker produces false
positives on deleted constructors
This commit is contained in:
parent
e36b23e17b
commit
d97e3d63f3
2 changed files with 12 additions and 0 deletions
|
@ -248,6 +248,8 @@ public class ClassMembersInitializationChecker extends AbstractIndexAstChecker {
|
||||||
private ICPPConstructor getConstructor(IASTDeclaration decl) {
|
private ICPPConstructor getConstructor(IASTDeclaration decl) {
|
||||||
if (decl instanceof ICPPASTFunctionDefinition) {
|
if (decl instanceof ICPPASTFunctionDefinition) {
|
||||||
ICPPASTFunctionDefinition functionDefinition = (ICPPASTFunctionDefinition) decl;
|
ICPPASTFunctionDefinition functionDefinition = (ICPPASTFunctionDefinition) decl;
|
||||||
|
// if (functionDefinition.isDeleted())
|
||||||
|
// return null;
|
||||||
IBinding binding = functionDefinition.getDeclarator().getName().resolveBinding();
|
IBinding binding = functionDefinition.getDeclarator().getName().resolveBinding();
|
||||||
if (binding instanceof ICPPConstructor) {
|
if (binding instanceof ICPPConstructor) {
|
||||||
ICPPConstructor constructor = (ICPPConstructor) binding;
|
ICPPConstructor constructor = (ICPPConstructor) binding;
|
||||||
|
|
|
@ -314,6 +314,16 @@ public class ClassMembersInitializationCheckerTest extends CheckerTestCase {
|
||||||
checkNoErrors();
|
checkNoErrors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// class C {
|
||||||
|
// public:
|
||||||
|
// C(const C& c) = delete;
|
||||||
|
// int i1, i2;
|
||||||
|
// };
|
||||||
|
public void testNoErrorsOnDeletedConstructor() {
|
||||||
|
loadCodeAndRun(getAboveComment());
|
||||||
|
checkNoErrors();
|
||||||
|
}
|
||||||
|
|
||||||
// void func(int & a) { a = 0; }
|
// void func(int & a) { a = 0; }
|
||||||
// class C {
|
// class C {
|
||||||
// C() { func(i); } // No warnings.
|
// C() { func(i); } // No warnings.
|
||||||
|
|
Loading…
Add table
Reference in a new issue