mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Bug 425033 - Restrict name lookup to types when
elaborated-type-specifier is present Change-Id: Ib4e681056edfab92d19072ccc74a54ffd7cec418 Signed-off-by: Nathan Ridge <zeratul976@hotmail.com> Reviewed-on: https://git.eclipse.org/r/22835 Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com> IP-Clean: Sergey Prigogin <eclipse.sprigogin@gmail.com> Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
This commit is contained in:
parent
68b2dd67dc
commit
9f9ed938d2
2 changed files with 20 additions and 6 deletions
|
@ -10553,4 +10553,18 @@ public class AST2CPPTests extends AST2TestBase {
|
|||
assertEquals(',', argumentTokens[1].getTokenCharImage()[0]);
|
||||
assertEquals('2', argumentTokens[2].getTokenCharImage()[0]);
|
||||
}
|
||||
|
||||
// struct MyStruct {
|
||||
// struct Inner {
|
||||
// int waldo;
|
||||
// } Inner;
|
||||
// };
|
||||
//
|
||||
// void foo() {
|
||||
// struct MyStruct::Inner in;
|
||||
// in.waldo;
|
||||
// }
|
||||
public void testFieldAndNestedTypeWithSameName_425033() throws Exception {
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -149,11 +149,7 @@ public class LookupData extends ScopeLookupData {
|
|||
|
||||
IASTNode parent = tn.getParent();
|
||||
IASTNode nameParent= parent;
|
||||
if (parent instanceof ICPPASTBaseSpecifier
|
||||
|| parent instanceof ICPPASTElaboratedTypeSpecifier
|
||||
|| parent instanceof ICPPASTCompositeTypeSpecifier) {
|
||||
typesOnly= true;
|
||||
} else if (parent instanceof ICPPASTQualifiedName) {
|
||||
if (parent instanceof ICPPASTQualifiedName) {
|
||||
final ICPPASTQualifiedName qn = (ICPPASTQualifiedName) parent;
|
||||
if (qn.getLastName() != tn) {
|
||||
// For resolving template id ambiguities we need to consider non-types.
|
||||
|
@ -173,7 +169,11 @@ public class LookupData extends ScopeLookupData {
|
|||
}
|
||||
}
|
||||
|
||||
if (nameParent instanceof ICPPASTUsingDeclaration) {
|
||||
if (nameParent instanceof ICPPASTBaseSpecifier
|
||||
|| nameParent instanceof ICPPASTElaboratedTypeSpecifier
|
||||
|| nameParent instanceof ICPPASTCompositeTypeSpecifier) {
|
||||
typesOnly= true;
|
||||
} else if (nameParent instanceof ICPPASTUsingDeclaration) {
|
||||
forUsingDeclaration= true;
|
||||
} else if (nameParent instanceof IASTDeclarator) {
|
||||
fDeclarator= (IASTDeclarator) nameParent;
|
||||
|
|
Loading…
Add table
Reference in a new issue