Decl::CheckAccessDeclContext() keeps asserting. Access is not set in some cases.

llvm-svn: 113419
This commit is contained in:
Argyrios Kyrtzidis 2010-09-08 21:58:42 +00:00
parent d4ec16ca71
commit e177863afc
1 changed files with 9 additions and 4 deletions

View File

@ -421,17 +421,22 @@ void Decl::CheckAccessDeclContext() const {
// Suppress this check if any of the following hold:
// 1. this is the translation unit (and thus has no parent)
// 2. this is a template parameter (and thus doesn't belong to its context)
// 3. the context is not a record
// 4. it's invalid
// 5. it's a C++0x static_assert.
// 3. this is a non-type template parameter
// 4. the context is not a record
// 5. it's invalid
// 6. it's a C++0x static_assert.
if (isa<TranslationUnitDecl>(this) ||
isa<TemplateTypeParmDecl>(this) ||
isa<NonTypeTemplateParmDecl>(this) ||
!isa<CXXRecordDecl>(getDeclContext()) ||
isInvalidDecl() ||
isa<StaticAssertDecl>(this) ||
// FIXME: a ParmVarDecl can have ClassTemplateSpecialization
// as DeclContext (?).
isa<ParmVarDecl>(this))
isa<ParmVarDecl>(this) ||
// FIXME: a ClassTemplateSpecialization or CXXRecordDecl can have
// AS_none as access specifier.
isa<CXXRecordDecl>(this))
return;
assert(Access != AS_none &&