[Issue 3182] New: compile time access of imported symbol

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jul 15 23:25:30 PDT 2009


http://d.puremagic.com/issues/show_bug.cgi?id=3182

           Summary: compile time access of imported symbol
           Product: D
           Version: unspecified
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: ellery-newcomer at utulsa.edu


The following code does not print 'z=1!' when compiled, as if a premature
attempted access to z causes the compiler to believe z doesn't exist even after
the import statement. Take out the first static if, and issue goes away. Change
the import to 'import test2: z;' and issue goes away.

Question: Would I be incorrect in assuming the expected output of this compile
should be

no z!
z!
z=1!


test.d
-------
import tango.io.Stdout;
static if(is(typeof(z))){
    pragma(msg,"z!");
}else{
    pragma(msg,"no z!");
}
import test2;
static if(is(typeof(z))){
    pragma(msg,"z!");
}else{
    pragma(msg,"no z!");
}
static if(z == 1) pragma(msg,"z=1!");

void main(){
}
-------
test2.d
-------
module test2;
const int z = 1;

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list