Bug 14057 – [REG2.066] opSlice not working correctly with AliasThis

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-01-27T04:02:00Z
Last change time
2015-02-18T03:41:37Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
jakobovrum

Comments

Comment #0 by jakobovrum — 2015-01-27T04:02:32Z
The below code should work, but doesn't: --- struct Wrapper { int[] subType; alias subType this; Wrapper opSlice(size_t, size_t) { return this; } } void main() { auto w = Wrapper(); Wrapper w2 = w[0 .. 1337]; } --- test.d(15): Error: cannot implicitly convert expression (w.subType[0..1337]) of type int[] to Wrapper --- The subtype with slice capabilities seems to get priority. This also happens if the subtype is another struct with opSlice.
Comment #1 by k.hara.pg — 2015-01-27T16:31:41Z
It's a regression introduced in 2.066. https://github.com/D-Programming-Language/dmd/pull/4350
Comment #2 by github-bugzilla — 2015-01-30T22:54:52Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/8aec324a4b536e027b5815047944492305acea6d fix Issue 14057 - opSlice not working correctly with AliasThis https://github.com/D-Programming-Language/dmd/commit/dd4ce3362351d53eadc0734fc3f2652553b7a518 Merge pull request #4350 from 9rnsr/fix14057 [REG2.066] Issue 14057 - opSlice not working correctly with AliasThis
Comment #3 by github-bugzilla — 2015-01-31T18:44:18Z
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/5e9006b90825453600b2080bca2ecd5f337deb14 Cleanup of #2724 Various semantic improvements Documentation improvements Disabled opSlice due to issue 14057 https://github.com/D-Programming-Language/phobos/commit/36cf60b4bf80ceca97ee13d4e16bdc499ccdd9c4 Re-enabled opSlice for std.exception.handle now that bug 14057 is fixed
Comment #4 by github-bugzilla — 2015-02-18T03:41:37Z