forked from OSchip/llvm-project
a forward class declaration matching a typedef name of a class
refers to the underlying class. This is radar 6859726. Steve, please read the radar for my rational. llvm-svn: 71181
This commit is contained in:
parent
5352454e6b
commit
0d451813f9
|
@ -1075,6 +1075,13 @@ Sema::ActOnForwardClassDeclaration(SourceLocation AtClassLoc,
|
|||
Diag(AtClassLoc, diag::err_redefinition_different_kind) << IdentList[i];
|
||||
Diag(PrevDecl->getLocation(), diag::note_previous_definition);
|
||||
}
|
||||
else if (TDD) {
|
||||
// a forward class declaration matching a typedef name of a class
|
||||
// refers to the underlying class.
|
||||
if (ObjCInterfaceType * OI =
|
||||
dyn_cast<ObjCInterfaceType>(TDD->getUnderlyingType()))
|
||||
PrevDecl = OI->getDecl();
|
||||
}
|
||||
}
|
||||
ObjCInterfaceDecl *IDecl = dyn_cast_or_null<ObjCInterfaceDecl>(PrevDecl);
|
||||
if (!IDecl) { // Not already seen? Make a forward decl.
|
||||
|
|
|
@ -22,3 +22,26 @@
|
|||
|
||||
@interface INTF2 : INTF1 // expected-error {{duplicate interface definition for class 'INTF2'}}
|
||||
@end
|
||||
|
||||
// 2nd test of a forward class declaration matching a typedef name
|
||||
// referring to class object.
|
||||
// FIXME. This may become a negative test should we decide to make this an error.
|
||||
//
|
||||
@interface NSObject @end
|
||||
|
||||
@protocol XCElementP @end
|
||||
|
||||
typedef NSObject <XCElementP> XCElement;
|
||||
|
||||
@interface XCElementMainImp {
|
||||
XCElement * _editingElement;
|
||||
}
|
||||
@end
|
||||
|
||||
@class XCElement;
|
||||
|
||||
@implementation XCElementMainImp
|
||||
- (XCElement *)editingElement { return _editingElement; }
|
||||
@end
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue