diff options
author | Douglas Gregor <dgregor@apple.com> | 2008-12-16 06:37:47 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2008-12-16 06:37:47 +0000 |
commit | 195002917eb8525f95caefd6fa0b785ace05a4df (patch) | |
tree | 7699aa4be77e6b52faa1b7387651e80315a42364 /clang/lib/Sema/SemaCXXScopeSpec.cpp | |
parent | 51559185f1d4c3c7633996a05f50b37eec90fce1 (diff) | |
download | bcm5719-llvm-195002917eb8525f95caefd6fa0b785ace05a4df.tar.gz bcm5719-llvm-195002917eb8525f95caefd6fa0b785ace05a4df.zip |
Partial fix for qualified name lookup, such that the lookup of N in
N::X only skips those entities specified in C++ [basic.lookup.qual]p1.
Note that both EDG and GCC currently get this wrong. EDG has confirmed
that the bug will be fixed in a future version.
llvm-svn: 61079
Diffstat (limited to 'clang/lib/Sema/SemaCXXScopeSpec.cpp')
-rw-r--r-- | clang/lib/Sema/SemaCXXScopeSpec.cpp | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/clang/lib/Sema/SemaCXXScopeSpec.cpp b/clang/lib/Sema/SemaCXXScopeSpec.cpp index 8b3218b33b1..fe9ae07ebac 100644 --- a/clang/lib/Sema/SemaCXXScopeSpec.cpp +++ b/clang/lib/Sema/SemaCXXScopeSpec.cpp @@ -28,8 +28,8 @@ namespace { DeclContext::lookup_const_iterator I, E;
for (llvm::tie(I, E) = LookupCtx->lookup(Context, Name); I != E; ++I) {
IdIsUndeclared = false;
- if (((*I)->getIdentifierNamespace() & Decl::IDNS_Tag) &&
- !isa<EnumDecl>(*I))
+ if (((*I)->getIdentifierNamespace() & Decl::IDNS_Tag) ||
+ isa<TypedefDecl>(*I))
return *I;
}
@@ -56,12 +56,10 @@ namespace { // not a class-name or namespace-name, the program is ill-formed.
for (; I != E; ++I) {
- if (TypedefDecl *TD = dyn_cast<TypedefDecl>(*I)) {
- if (TD->getUnderlyingType()->isRecordType())
- break;
- continue;
+ if (isa<TypedefDecl>(*I)) {
+ break;
}
- if (((*I)->getIdentifierNamespace()&Decl::IDNS_Tag) && !isa<EnumDecl>(*I))
+ if (((*I)->getIdentifierNamespace() & Decl::IDNS_Tag))
break;
}
@@ -100,13 +98,14 @@ Sema::CXXScopeTy *Sema::ActOnCXXNestedNameSpecifier(Scope *S, if (SD) {
if (TypedefDecl *TD = dyn_cast<TypedefDecl>(SD)) {
- assert(TD->getUnderlyingType()->isRecordType() &&"Invalid Scope Decl!");
- SD = TD->getUnderlyingType()->getAsRecordType()->getDecl();
+ if (const RecordType* Record = TD->getUnderlyingType()->getAsRecordType())
+ return cast<DeclContext>(Record->getDecl());
+ } else if (isa<NamespaceDecl>(SD) || isa<RecordDecl>(SD)) {
+ return cast<DeclContext>(SD);
}
- assert((isa<NamespaceDecl>(SD) || isa<RecordDecl>(SD)) &&
- "Invalid Scope Decl!");
- return cast<DeclContext>(SD);
+ // Fall through to produce an error: we found something that isn't
+ // a class or a namespace.
}
unsigned DiagID;
|