[Issue 2848] New: static if (is(type)) + alias fails to compile
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Fri Apr 17 10:25:39 PDT 2009
    
    
  
http://d.puremagic.com/issues/show_bug.cgi?id=2848
           Summary: static if (is(type)) + alias fails to compile
           Product: D
           Version: 1.043
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: llucax at gmail.com
This simple test fails to compile:
static if (!is(typeof(no_type)))
        alias char[] no_type;
no_type x;
In all D compilers available, tested in GDC, DMD 1.043, DMD 2.027 and LDC r1197
(so it seems like a front-end issue).
The error is:
t.d:3: Error: identifier 'no_type' is not defined
t.d:3: Error: no_type is used as a type
t.d:3: variable t.x voids have no value
This test doesn't compile either:
static if (!is(typeof(no_type))) {
        alias char[] no_type;
        no_type y;
}
Error:
t.d(3): Error: identifier 'no_type' is not defined
t.d(3): Error: no_type is used as a type
t.d(3): variable t.x voids have no value
-- 
    
    
More information about the Digitalmars-d-bugs
mailing list