Bug 16633 – Case where an alias this is tried before the object itself

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-10-21T17:22:56Z
Last change time
2018-11-05T13:18:27Z
Keywords
wrong-code
Assigned to
No Owner
Creator
Basile-z
See also
https://issues.dlang.org/show_bug.cgi?id=8663

Comments

Comment #0 by b2.temp — 2016-10-21T17:22:56Z
class Item { alias children this; Item[] children; void populate() { children ~= new Item; // Item is seen as [] assert(children.length == 1); } } void main() { Item root = new Item; root.populate; } https://forum.dlang.org/thread/[email protected]
Comment #1 by schveiguy — 2016-10-21T19:30:07Z
I think the summary was incorrect, please revert if I was wrong.
Comment #2 by razvan.nitu1305 — 2018-10-19T11:31:39Z
Comment #3 by github-bugzilla — 2018-11-05T13:18:26Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/d6c255b598e786e204cfc5b34d3e9d875a52cb16 Fix Issue 16633 - Case where an alias this is tried before the object itself https://github.com/dlang/dmd/commit/7c2a70a72631c0bc17f05f3a3c53c3735c581e31 Merge pull request #8846 from RazvanN7/Issue_16633 Fix Issue 16633 - Case where an alias this is tried before the object itself