forked from OSchip/llvm-project
Fix a minor crash bug with constructs like Obj.Class::ENUM_VALUE.
llvm-svn: 109537
This commit is contained in:
parent
4f6e73b168
commit
7530049b16
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue