зеркало из https://github.com/microsoft/clang-1.git
Fix a minor crash bug with constructs like Obj.Class::ENUM_VALUE.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109537 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
58115009ba
Коммит
0246376203
|
@ -2628,12 +2628,12 @@ bool Sema::CheckQualifiedMemberReference(Expr *BaseExpr,
|
|||
return false;
|
||||
|
||||
// Note that we use the DC of the decl, not the underlying decl.
|
||||
CXXRecordDecl *RecordD = cast<CXXRecordDecl>((*I)->getDeclContext());
|
||||
while (RecordD->isAnonymousStructOrUnion())
|
||||
RecordD = cast<CXXRecordDecl>(RecordD->getParent());
|
||||
DeclContext *DC = (*I)->getDeclContext();
|
||||
while (DC->isTransparentContext())
|
||||
DC = DC->getParent();
|
||||
|
||||
llvm::SmallPtrSet<CXXRecordDecl*,4> MemberRecord;
|
||||
MemberRecord.insert(RecordD->getCanonicalDecl());
|
||||
MemberRecord.insert(cast<CXXRecordDecl>(DC)->getCanonicalDecl());
|
||||
|
||||
if (!IsProvablyNotDerivedFrom(*this, BaseRecord, MemberRecord))
|
||||
return false;
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
||||
|
||||
// Check that this doesn't crash.
|
||||
struct A {
|
||||
enum {LABEL};
|
||||
};
|
||||
int f() {
|
||||
return A().A::LABEL;
|
||||
}
|
||||
|
Загрузка…
Ссылка в новой задаче