From d0d2ee0e4bbe915d649e983c12d37bcfcf58823c Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Fri, 15 Jan 2010 01:44:47 +0000 Subject: When performing qualified name lookup into the current instantiation, do not look into base classes if there are any dependent base classes. Instead, note in the lookup result that we couldn't look into any dependent bases. Use that new result kind to detect when this case occurs, so that we can fall back to treating the type/value/etc. as a member of an unknown specialization. Fixes an issue where we were resolving lookup at template definition time and then missing an ambiguity at template instantiation time. llvm-svn: 93497 --- clang/lib/Sema/Lookup.h | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'clang/lib/Sema/Lookup.h') diff --git a/clang/lib/Sema/Lookup.h b/clang/lib/Sema/Lookup.h index e761346c677..9064de6aa01 100644 --- a/clang/lib/Sema/Lookup.h +++ b/clang/lib/Sema/Lookup.h @@ -32,6 +32,11 @@ public: /// @brief No entity found met the criteria. NotFound = 0, + /// @brief No entity found met the criteria within the current + /// instantiation,, but there were dependent base classes of the + /// current instantiation that could not be searched. + NotFoundInCurrentInstantiation, + /// @brief Name lookup found a single declaration that met the /// criteria. getFoundDecl() will return this declaration. Found, @@ -268,6 +273,19 @@ public: Decls.set_size(N); } + /// \brief Determine whether no result was found because we could not + /// search into dependent base classes of the current instantiation. + bool wasNotFoundInCurrentInstantiation() const { + return ResultKind == NotFoundInCurrentInstantiation; + } + + /// \brief Note that while no result was found in the current instantiation, + /// there were dependent base classes that could not be searched. + void setNotFoundInCurrentInstantiation() { + assert(ResultKind == NotFound && Decls.empty()); + ResultKind = NotFoundInCurrentInstantiation; + } + /// \brief Resolves the result kind of the lookup, possibly hiding /// decls. /// @@ -278,9 +296,10 @@ public: /// \brief Re-resolves the result kind of the lookup after a set of /// removals has been performed. void resolveKindAfterFilter() { - if (Decls.empty()) - ResultKind = NotFound; - else { + if (Decls.empty()) { + if (ResultKind != NotFoundInCurrentInstantiation) + ResultKind = NotFound; + } else { ResultKind = Found; resolveKind(); } -- cgit v1.2.3