1
0
Fork 0
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:
Markus Schorn 2010-08-13 10:58:14 +00:00
parent ca643bbb15
commit 507d844b5e
2 changed files with 13 additions and 2 deletions

View file

@ -8711,6 +8711,13 @@ public class AST2CPPTests extends AST2BaseTest {
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 {
// struct S {};
// }

View file

@ -896,8 +896,12 @@ public class CPPVisitor extends ASTQueries {
ASTNodeProperty prop = parent.getPropertyInParent();
if (prop == IASTSimpleDeclaration.DECLARATOR)
return dtor.getFunctionScope();
else if (prop == IASTFunctionDefinition.DECLARATOR)
return ((IASTCompoundStatement) ((IASTFunctionDefinition) parent.getParent()).getBody()).getScope();
else if (prop == IASTFunctionDefinition.DECLARATOR) {
final IASTCompoundStatement body = (IASTCompoundStatement) ((IASTFunctionDefinition) parent.getParent()).getBody();
if (body != null)
return body.getScope();
return dtor.getFunctionScope();
}
}
} else if (parent instanceof ICPPASTTemplateDeclaration) {
return CPPTemplates.getContainingScope(node);