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 36e3d3ad11
commit e75a7388a0
2 changed files with 13 additions and 2 deletions

View file

@ -471,4 +471,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

@ -879,8 +879,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();