www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Undefined identifier, is that intended ?

reply "deadalnix" <deadalnix gmail.com> writes:
I have this :

import d.ast.identifier;
alias AstCatchBlock = CatchBlock!(Identifier, AstStatement);

Identifier is a class defined in d.ast.identifier. I get the 
following error :
Error: undefined identifier Identifier

It seem dubious to me, but current version of DMD does this and 
master as well. The behavior is consistent.

When i declare the import at the top of the file, then it works. 
Am I missing something or this is a bug ?
Dec 14 2013
parent "qznc" <qznc web.de> writes:
On Sunday, 15 December 2013 at 05:38:59 UTC, deadalnix wrote:
 I have this :

 import d.ast.identifier;
 alias AstCatchBlock = CatchBlock!(Identifier, AstStatement);

 Identifier is a class defined in d.ast.identifier. I get the 
 following error :
 Error: undefined identifier Identifier

 It seem dubious to me, but current version of DMD does this and 
 master as well. The behavior is consistent.

 When i declare the import at the top of the file, then it 
 works. Am I missing something or this is a bug ?
Do you import inside any scope? I had a similar problem recently, but was unable to reduce it into a small program. I had to move declarations out of unittest{}.
Dec 16 2013