// We won't add this decl to the current scope. We want the namespace
// name to return the original namespace decl during a name lookup.
} else {
+ printf("Weird\n");
// This is an invalid name redefinition.
Diag(Namespc->getLocation(), diag::err_redefinition_different_kind,
Namespc->getName());
// Check for another declaration kind with the same name.
Decl *PrevDecl = LookupDecl(IdentList[i], Decl::IDNS_Ordinary, TUScope);
if (PrevDecl && !isa<ObjCInterfaceDecl>(PrevDecl)) {
- Diag(AtClassLoc, diag::err_redefinition_different_kind,
- IdentList[i]->getName());
- Diag(PrevDecl->getLocation(), diag::err_previous_definition);
+ // GCC apparently allows the following idiom:
+ //
+ // typedef NSObject < XCElementTogglerP > XCElementToggler;
+ // @class XCElementToggler;
+ //
+ // FIXME: Make an extension?
+ TypedefDecl *TDD = dyn_cast<TypedefDecl>(PrevDecl);
+ if (!TDD || !isa<ObjCInterfaceType>(TDD->getUnderlyingType())) {
+ Diag(AtClassLoc, diag::err_redefinition_different_kind,
+ IdentList[i]->getName());
+ Diag(PrevDecl->getLocation(), diag::err_previous_definition);
+ }
}
ObjCInterfaceDecl *IDecl = dyn_cast_or_null<ObjCInterfaceDecl>(PrevDecl);
if (!IDecl) { // Not already seen? Make a forward decl.
@protocol XCElementTogglerP < XCElementP > -(void) setDisplayed:(BOOL) displayed;
@end
-// FIXME: investigate this redefinition error - gcc apparently accepts it.
-typedef NSObject < XCElementTogglerP > XCElementToggler; // expected-error{{previous definition is here}}
+typedef NSObject < XCElementTogglerP > XCElementToggler;
@interface XCElementRootFace:NSObject {} @end
@interface XCElementFace:XCElementRootFace {} @end
-@class XCElementToggler; // expected-error{{redefinition of 'XCElementToggler' as different kind of symbol}}
+@class XCElementToggler;
@interface XCRASlice:XCElementFace {} @end