www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21795] New: Spurious error: static variable `i` cannot be

https://issues.dlang.org/show_bug.cgi?id=21795

          Issue ID: 21795
           Summary: Spurious error: static variable `i` cannot be read at
                    compile time as default argument to template alias
                    parameter
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: iamthewilsonator hotmail.com

template G(T)
{
    struct G
    {
        static int i;
    }
}

struct H2(F = float, alias e_ = G!double.i) {}
H2!(float) c; // fails with "static variable `i` cannot be read at compile
time"

H2!(float, G!double.i) c; // passes

see also https://issues.dlang.org/show_bug.cgi?id=16472

--
Apr 03