[cfe-commits] r91809 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/CXX/class.derived/p2.cpp
Eli Friedman
eli.friedman at gmail.com
Sun Dec 20 17:42:39 PST 2009
Author: efriedma
Date: Sun Dec 20 19:42:38 2009
New Revision: 91809
URL: http://llvm.org/viewvc/llvm-project?rev=91809&view=rev
Log:
Fix for PR5840: fix the kind of name lookup used for classes in
Sema::getTypeName.
"LookupNestedNameSpecifierName" isn't quite the right kind of lookup, though;
it doesn't ignore namespaces. Someone more familiar with the lookup code
should fix this properly.
Added:
cfe/trunk/test/CXX/class.derived/p2.cpp
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=91809&r1=91808&r2=91809&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Sun Dec 20 19:42:38 2009
@@ -106,8 +106,12 @@
if (!LookupCtx->isDependentContext() && RequireCompleteDeclContext(*SS))
return 0;
}
-
- LookupResult Result(*this, &II, NameLoc, LookupOrdinaryName);
+
+ // FIXME: LookupNestedNameSpecifierName isn't the right kind of
+ // lookup for class-names.
+ LookupNameKind Kind = isClassName ? LookupNestedNameSpecifierName :
+ LookupOrdinaryName;
+ LookupResult Result(*this, &II, NameLoc, Kind);
if (LookupCtx) {
// Perform "qualified" name lookup into the declaration context we
// computed, which is either the type of the base of a member access
Added: cfe/trunk/test/CXX/class.derived/p2.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/class.derived/p2.cpp?rev=91809&view=auto
==============================================================================
--- cfe/trunk/test/CXX/class.derived/p2.cpp (added)
+++ cfe/trunk/test/CXX/class.derived/p2.cpp Sun Dec 20 19:42:38 2009
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 %s -fsyntax-only -verify
+
+// "During the lookup for a base class name, non-type names are ignored"
+namespace PR5840 {
+ struct Base {};
+ int Base = 10;
+ struct Derived : Base {};
+}
More information about the cfe-commits
mailing list