Bug 15754 – can access alias from instance but not from type
Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-03-04T13:27:01Z
Last change time
2018-06-12T15:20:42Z
Assigned to
No Owner
Creator
John Colvin
Comments
Comment #0 by john.loughran.colvin — 2016-03-04T13:27:01Z
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?).
Comment #1 by razvan.nitu1305 — 2018-06-12T15:20:42Z
The code in the original bug post now compiles successfully with master git HEAD. Closing as fixed.