Thread overview
Rules for Symbol Name Lookup seem contradictory
Jun 22, 2020
Manfred Nowak
Jun 22, 2020
user1234
Jun 22, 2020
Manfred Nowak
June 22, 2020
https://dlang.org/spec/module.html#name_lookup contains under 4.3.4 only two sentences.

While the first sentence explains, that the search ends
  "as soon as a matching symbol is found",
the second sentence implies that the search may continue until it is sure, that
  no other symbol "with the same name" can be found
in the current phase.

This means, that under sentence one the following code is free of errors and under sentence two the following code has to be rejected, because an ambiguity exists.

De facto the code compiles without error under dmd v2.092.1:

class C{
}
class D{
  C c;
  this(){
    auto c= new C;
  }
}
void main(){
  auto d= new D;
}
June 22, 2020
On Monday, 22 June 2020 at 01:38:41 UTC, Manfred Nowak wrote:
> https://dlang.org/spec/module.html#name_lookup contains under 4.3.4 only two sentences.
>
> While the first sentence explains, that the search ends
>   "as soon as a matching symbol is found",
> the second sentence implies that the search may continue until it is sure, that
>   no other symbol "with the same name" can be found
> in the current phase.
>
> This means, that under sentence one the following code is free of errors and under sentence two the following code has to be rejected, because an ambiguity exists.
>
> De facto the code compiles without error under dmd v2.092.1:
>
> class C{
> }
> class D{
>   C c;
>   this(){
>     auto c= new C;
>   }
> }
> void main(){
>   auto d= new D;
> }

Classes (non templatized) cannot be overloaded so in your example the rule that applies is that the one from the most inner scope is selected.
For functions and templates this is another story. As they can be part of overload set, they are all selected by name and then tried with the arguments (template or call args) and if two matches then the error happens.

Maybe that the spec is a bit vague as it doesn't mention that rules for lookups of non overloadable symbols are more simple.
June 22, 2020
On Monday, 22 June 2020 at 02:16:52 UTC, user1234 wrote:
[...]
> Maybe that the spec is a bit vague as it doesn't mention that
[...]
A vague place in a spec is usually called "Dark Corner" and the functionality then marked as "Implementation defined".

But this mark is missing here.

And restricting the validity of the contradictory seeming sentences to overloadables only, puts all others into an unregulated state.

Therefore the stated problem stays unexplained.