Rules for Symbol Name Lookup seem contradictory

Manfred Nowak svv1999 at hotmail.com
Mon Jun 22 01:38:41 UTC 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;
}


More information about the Digitalmars-d-learn mailing list