Currently the lookup for a declaration conflicting with an enumerator has two issues, both originating from the use of LookupResult::getAsSingle<NameDecl>():
- getAsSingle returns nothing if an overload set or an UnresolvedUsingValueDecl is found.
- getAsSingle calls internally NamedDecl::getUnderlyingDecl on the result. This cause problems with using-declarations and namespace aliases.
While we are at it, also do the check for a conflicting declaration before calling CheckShadow (which implements Wshadow). This avoids redundant Wshadow warnings where we already have an error.
Note that this is not the only place where getAsSingle is mistakenly used, but this is better addressed in a later patch.
behaves as no -> behaves as if no