diff options
| author | Eli Friedman <eli.friedman@gmail.com> | 2010-08-06 23:41:47 +0000 |
|---|---|---|
| committer | Eli Friedman <eli.friedman@gmail.com> | 2010-08-06 23:41:47 +0000 |
| commit | 964dbda0e99007bb2e6e9da6ab413f24e635327f (patch) | |
| tree | 9faabc1af2799594023ea27c1d544d11b2c03ad6 /clang/lib/Sema/SemaExpr.cpp | |
| parent | f16a9bc5b9a75e0ab8e10606f3073685c5788553 (diff) | |
| download | bcm5719-llvm-964dbda0e99007bb2e6e9da6ab413f24e635327f.tar.gz bcm5719-llvm-964dbda0e99007bb2e6e9da6ab413f24e635327f.zip | |
PR7837: For qualified id's, make sure the decl context is complete if not
dependent in ActOnIdExpression. (This issue only shows up with member
operators because an operator is never a type.)
llvm-svn: 110486
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 46c5a65f75d..82a2bb2982c 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -699,23 +699,6 @@ static bool IsFullyFormedScope(Sema &SemaRef, CXXRecordDecl *Record) { return true; } -/// Determines whether we can lookup this id-expression now or whether -/// we have to wait until template instantiation is complete. -static bool IsDependentIdExpression(Sema &SemaRef, const CXXScopeSpec &SS) { - DeclContext *DC = SemaRef.computeDeclContext(SS, false); - - // If the qualifier scope isn't computable, it's definitely dependent. - if (!DC) return true; - - // If the qualifier scope doesn't name a record, we can always look into it. - if (!isa<CXXRecordDecl>(DC)) return false; - - // We can't look into record types unless they're fully-formed. - if (!IsFullyFormedScope(SemaRef, cast<CXXRecordDecl>(DC))) return true; - - return false; -} - /// Determines if the given class is provably not derived from all of /// the prospective base classes. static bool IsProvablyNotDerivedFrom(Sema &SemaRef, @@ -1100,9 +1083,24 @@ Sema::OwningExprResult Sema::ActOnIdExpression(Scope *S, // names a dependent type. // Determine whether this is a member of an unknown specialization; // we need to handle these differently. - if ((Name.getNameKind() == DeclarationName::CXXConversionFunctionName && - Name.getCXXNameType()->isDependentType()) || - (SS.isSet() && IsDependentIdExpression(*this, SS))) { + bool DependentID = false; + if (Name.getNameKind() == DeclarationName::CXXConversionFunctionName && + Name.getCXXNameType()->isDependentType()) { + DependentID = true; + } else if (SS.isSet()) { + DeclContext *DC = computeDeclContext(SS, false); + if (DC) { + if (RequireCompleteDeclContext(SS, DC)) + return ExprError(); + // FIXME: We should be checking whether DC is the current instantiation. + if (CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(DC)) + DependentID = !IsFullyFormedScope(*this, RD); + } else { + DependentID = true; + } + } + + if (DependentID) { return ActOnDependentIdExpression(SS, Name, NameLoc, isAddressOfOperand, TemplateArgs); |

