1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 356730: Resolution of designated initializers

This commit is contained in:
Markus Schorn 2011-09-07 12:57:05 +02:00
parent b91945ccac
commit c4e19ace4c
2 changed files with 13 additions and 2 deletions

View file

@ -464,4 +464,15 @@ public class IndexCBindingResolutionBugs extends IndexBindingResolutionTestBase
getBindingFromASTName("f255", 0);
getBindingFromASTName("f256", 0);
}
// struct B {
// float f;
// };
// struct B b = {
// .f = 3.1
// };
public void testDesignatedInitializer_Bug210019() throws Exception {
IField f= getBindingFromASTName("f", 0);
}
}

View file

@ -887,8 +887,8 @@ public class CVisitor extends ASTQueries {
else if (simpleDecl.getDeclSpecifier() instanceof IASTCompositeTypeSpecifier)
struct = ((IASTCompositeTypeSpecifier) simpleDecl.getDeclSpecifier()).getName().resolveBinding();
if (struct instanceof CStructure) {
return ((CStructure) struct).findField(((ICASTFieldDesignator) node).getName().toString());
if (struct instanceof ICompositeType) {
return ((ICompositeType) struct).findField(((ICASTFieldDesignator) node).getName().toString());
} else if (struct instanceof ITypeContainer) {
IType type;
type = ((ITypeContainer) struct).getType();