Bug 7126 – struct constructor ignored with global initializers
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
Linux
Creation time
2011-12-17T12:58:00Z
Last change time
2011-12-17T13:40:17Z
Assigned to
nobody
Creator
siegelords_abode
Comments
Comment #0 by siegelords_abode — 2011-12-17T12:58:30Z
struct new_int
{
this(int val)
{
payload = val;
}
int payload = -1;
alias payload this;
}
new_int a = 1; // Error: cannot implicitly convert expression (1) of type int to new_int
void main()
{
new_int b = 1; // Works ok
}
Comment #1 by timon.gehr — 2011-12-17T13:40:17Z
*** This issue has been marked as a duplicate of issue 7019 ***