diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-01-15 01:44:47 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-01-15 01:44:47 +0000 |
commit | d0d2ee0e4bbe915d649e983c12d37bcfcf58823c (patch) | |
tree | e84d564718d0297f1e487a709313b739337bd066 /clang/lib/Sema/Lookup.h | |
parent | cefa7addc88b8f34501fd23250dca5772ef9f594 (diff) | |
download | bcm5719-llvm-d0d2ee0e4bbe915d649e983c12d37bcfcf58823c.tar.gz bcm5719-llvm-d0d2ee0e4bbe915d649e983c12d37bcfcf58823c.zip |
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
Diffstat (limited to 'clang/lib/Sema/Lookup.h')
-rw-r--r-- | clang/lib/Sema/Lookup.h | 25 |
1 files changed, 22 insertions, 3 deletions
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(); } |