Bug 11877 – static opSlice is not possible

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-01-07T05:01:05Z
Last change time
2024-12-13T18:15:41Z
Keywords
pull
Assigned to
No Owner
Creator
Dicebot
Moved to GitHub: dmd#18748 →

Comments

Comment #0 by public — 2014-01-07T05:01:05Z
struct X { static int opSlice(size_t a, size_t b) { return 42; } } static assert ( X[1..2] == 42 ); // Error: cannot slice type 'X' ------------------------------------------- There is not reason why slicing should be prohibited in this case. It conforms usual operator syntax rewrite rules and has no grammar ambiguity with array types if slicing bounds are used.
Comment #1 by greensunny12 — 2018-02-16T00:58:54Z
See also the current forum discussion: https://forum.dlang.org/post/[email protected] And the submitted PR wasn't linked here: https://github.com/dlang/dmd/pull/3071
Comment #2 by robert.schadek — 2024-12-13T18:15:41Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18748 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB