www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15754] New: can access alias from instance but not from type

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

          Issue ID: 15754
           Summary: can access alias from instance but not from type
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: john.loughran.colvin gmail.com

struct Capture(alias v)
{
    alias a = v;
}

void main()
{
    int a = 3;
    foo(Capture!a());
}

void foo(C)(C c)
{
//f3.d(14): Error: function D main is a nested function and cannot be accessed
from f3.foo!(Capture!(a)).foo
//    auto a = C.a; 


// OK:
    auto a = C().a;
}

For a start, the error message is seriously confusing (main is nested function?
Whut?).

--
Mar 04 2016