Bug 8925 – Constructor is called instead of opCall if constructor is generic

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-10-31T20:21:00Z
Last change time
2013-02-09T22:29:13Z
Keywords
wrong-code
Assigned to
nobody
Creator
malteskarupke

Comments

Comment #0 by malteskarupke — 2012-10-31T20:21:28Z
void main() { struct S { this(T)(auto ref T t) { } void opCall(int i) { x = i; } int x; } S s; s(5); assert(s.x == 5); } That assert will fail in DMD 2.060 because the line s(5) will actually call the constructor.
Comment #1 by andrej.mitrovich — 2012-10-31T20:40:18Z
Seems to work ok in Git head, I don't know which pull fixed it.
Comment #2 by malteskarupke — 2012-10-31T20:51:35Z
It may actually have been this one: http://d.puremagic.com/issues/show_bug.cgi?id=6036 (Which is marked as fixed, even though it clearly still doesn't work until there is a new version of DMD)
Comment #3 by andrej.mitrovich — 2013-02-09T22:29:13Z
Fixed in 2.061.