Fix invalid error about duplicate declaration of padding bit field in

an interface.

llvm-svn: 70652
This commit is contained in:
Daniel Dunbar 2009-05-03 01:08:28 +00:00
parent 3e3e69bbe7
commit bdb23a1f56
2 changed files with 10 additions and 6 deletions

View File

@ -3980,12 +3980,14 @@ void Sema::ActOnFields(Scope* S,
for (ObjCInterfaceDecl::ivar_iterator IVI = ID->ivar_begin(),
IVE = ID->ivar_end(); IVI != IVE; ++IVI) {
ObjCIvarDecl* Ivar = (*IVI);
IdentifierInfo *II = Ivar->getIdentifier();
ObjCIvarDecl* prevIvar =
ID->getSuperClass()->lookupInstanceVariable(Context, II);
if (prevIvar) {
Diag(Ivar->getLocation(), diag::err_duplicate_member) << II;
Diag(prevIvar->getLocation(), diag::note_previous_declaration);
if (IdentifierInfo *II = Ivar->getIdentifier()) {
ObjCIvarDecl* prevIvar =
ID->getSuperClass()->lookupInstanceVariable(Context, II);
if (prevIvar) {
Diag(Ivar->getLocation(), diag::err_duplicate_member) << II;
Diag(prevIvar->getLocation(), diag::note_previous_declaration);
}
}
}
}

View File

@ -3,6 +3,7 @@
@interface B1 {
@public
double fill_B; // expected-note {{previous declaration is here}}
unsigned : 0;
}
@end
@ -10,6 +11,7 @@
@public
int one; // expected-note {{previous declaration is here}}
int one; // expected-error {{duplicate member 'one'}}
unsigned : 0;
}
@end