[Issue 21795] New: Spurious error: static variable `i` cannot be read at compile time as default argument to template alias parameter

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Apr 4 01:48:21 UTC 2021


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 at puremagic.com
          Reporter: iamthewilsonator at 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

--


More information about the Digitalmars-d-bugs mailing list