forked from OSchip/llvm-project
When determining whether we can use "this", make sure to look through
enum contexts (along with block contexts, which we already did). Fixes PR7196. llvm-svn: 104444
This commit is contained in:
parent
959d5a0cbd
commit
0c6f539564
|
@ -305,7 +305,7 @@ void Sema::ActOnEndOfTranslationUnit() {
|
|||
DeclContext *Sema::getFunctionLevelDeclContext() {
|
||||
DeclContext *DC = CurContext;
|
||||
|
||||
while (isa<BlockDecl>(DC))
|
||||
while (isa<BlockDecl>(DC) || isa<EnumDecl>(DC))
|
||||
DC = DC->getParent();
|
||||
|
||||
return DC;
|
||||
|
|
|
@ -147,3 +147,15 @@ namespace PR7153 {
|
|||
ec.member = 0;
|
||||
}
|
||||
}
|
||||
|
||||
namespace PR7196 {
|
||||
struct A {
|
||||
int a;
|
||||
|
||||
void f() {
|
||||
char i[sizeof(a)];
|
||||
enum { x = sizeof(i) };
|
||||
enum { y = sizeof(a) };
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue