Bug 8945 – Can't call static struct initializer or constructor without qualifier for templated inner struct
Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-11-02T11:01:00Z
Last change time
2013-03-24T20:57:28Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
verylonglogin.reg
Comments
Comment #0 by verylonglogin.reg — 2012-11-02T11:01:28Z
---
struct S // or `class`, or `union`
{
struct S0(T) { int i; }
struct S1(T) { this(int){} }
}
void main()
{
auto cs01 = const S.S0!int(); // ok
auto cs02 = const S.S0!int(1); // ok
auto cs1 = const S.S1!int(1); // ok
auto s01 = S.S0!int(); // Error: struct S0 does not overload ()
auto s02 = S.S0!int(1); // Error: struct S0 does not overload ()
auto s1 = S.S1!int(1); // Error: struct S1 does not overload ()
}
---
Comment #1 by verylonglogin.reg — 2012-11-02T11:04:45Z
An easy workaround:
---
auto s01 = S.S0!int.init;
auto s02 = cast(S.S0!int) 1;
auto s1 = cast(S.S1!int) 1;
---