Objective-C: Fixes an ivar lookup bug where
'ivar' was used inside a record/union used as argument to __typeof. // rdar14037151 pr5984 llvm-svn: 183048
This commit is contained in:
parent
7b1b4db35e
commit
deac9ac546
|
@ -824,6 +824,8 @@ FunctionDecl *Sema::getCurFunctionDecl() {
|
|||
|
||||
ObjCMethodDecl *Sema::getCurMethodDecl() {
|
||||
DeclContext *DC = getFunctionLevelDeclContext();
|
||||
while (isa<RecordDecl>(DC))
|
||||
DC = DC->getParent();
|
||||
return dyn_cast<ObjCMethodDecl>(DC);
|
||||
}
|
||||
|
||||
|
|
|
@ -80,3 +80,34 @@ extern struct foo x;
|
|||
int IVAR; // expected-error {{instance variable is already declared}}
|
||||
}
|
||||
@end
|
||||
|
||||
// PR5984
|
||||
// rdar://14037151
|
||||
@interface Radar14037151 {
|
||||
int myStatus;
|
||||
}
|
||||
- (int) test;
|
||||
@end
|
||||
|
||||
@implementation Radar14037151
|
||||
- (int) test
|
||||
{
|
||||
myStatus = 1; // works
|
||||
__typeof(myStatus) __in; // works.
|
||||
union U {
|
||||
__typeof(myStatus) __in; // fails.
|
||||
};
|
||||
struct S {
|
||||
__typeof(myStatus) __in; // fails.
|
||||
struct S1 {
|
||||
__typeof(myStatus) __in; // fails.
|
||||
struct S {
|
||||
__typeof(myStatus) __in; // fails.
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
return 0;
|
||||
}
|
||||
@end
|
||||
|
||||
|
|
Loading…
Reference in New Issue