зеркало из https://github.com/microsoft/clang-1.git
When determining whether we can use "this", make sure to look through
enum contexts (along with block contexts, which we already did). Fixes PR7196. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104444 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
0fddb97901
Коммит
d9008318fe
|
@ -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) };
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче