Skip to content
Snippets Groups Projects
Commit 0c6f5395 authored by Douglas Gregor's avatar Douglas Gregor
Browse files

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
parent 959d5a0c
No related branches found
No related tags found
No related merge requests found
...@@ -305,7 +305,7 @@ void Sema::ActOnEndOfTranslationUnit() { ...@@ -305,7 +305,7 @@ void Sema::ActOnEndOfTranslationUnit() {
DeclContext *Sema::getFunctionLevelDeclContext() { DeclContext *Sema::getFunctionLevelDeclContext() {
DeclContext *DC = CurContext; DeclContext *DC = CurContext;
while (isa<BlockDecl>(DC)) while (isa<BlockDecl>(DC) || isa<EnumDecl>(DC))
DC = DC->getParent(); DC = DC->getParent();
return DC; return DC;
......
...@@ -147,3 +147,15 @@ namespace PR7153 { ...@@ -147,3 +147,15 @@ namespace PR7153 {
ec.member = 0; ec.member = 0;
} }
} }
namespace PR7196 {
struct A {
int a;
void f() {
char i[sizeof(a)];
enum { x = sizeof(i) };
enum { y = sizeof(a) };
}
};
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment