mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 305978: [C++ 0x] Deleted functions, additional testcase and a fix.
This commit is contained in:
parent
ca643bbb15
commit
507d844b5e
2 changed files with 13 additions and 2 deletions
|
@ -8711,6 +8711,13 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
assertTrue(fb.isDeleted());
|
assertTrue(fb.isDeleted());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// const int b=12;
|
||||||
|
// void f(int a= b) = delete ;
|
||||||
|
public void testDefaultedAndDeletedFunctions_305978b() throws Exception {
|
||||||
|
String code= getAboveComment();
|
||||||
|
parseAndCheckBindings(code);
|
||||||
|
}
|
||||||
|
|
||||||
// namespace ns {
|
// namespace ns {
|
||||||
// struct S {};
|
// struct S {};
|
||||||
// }
|
// }
|
||||||
|
|
|
@ -896,8 +896,12 @@ public class CPPVisitor extends ASTQueries {
|
||||||
ASTNodeProperty prop = parent.getPropertyInParent();
|
ASTNodeProperty prop = parent.getPropertyInParent();
|
||||||
if (prop == IASTSimpleDeclaration.DECLARATOR)
|
if (prop == IASTSimpleDeclaration.DECLARATOR)
|
||||||
return dtor.getFunctionScope();
|
return dtor.getFunctionScope();
|
||||||
else if (prop == IASTFunctionDefinition.DECLARATOR)
|
else if (prop == IASTFunctionDefinition.DECLARATOR) {
|
||||||
return ((IASTCompoundStatement) ((IASTFunctionDefinition) parent.getParent()).getBody()).getScope();
|
final IASTCompoundStatement body = (IASTCompoundStatement) ((IASTFunctionDefinition) parent.getParent()).getBody();
|
||||||
|
if (body != null)
|
||||||
|
return body.getScope();
|
||||||
|
return dtor.getFunctionScope();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (parent instanceof ICPPASTTemplateDeclaration) {
|
} else if (parent instanceof ICPPASTTemplateDeclaration) {
|
||||||
return CPPTemplates.getContainingScope(node);
|
return CPPTemplates.getContainingScope(node);
|
||||||
|
|
Loading…
Add table
Reference in a new issue