Bug 22446 – isInputRange fails to recognize range if element type is nested struct that has a copy ctor

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-10-28T05:14:26Z
Last change time
2024-12-13T19:18:56Z
Assigned to
No Owner
Creator
Stanislav Blinov
Moved to GitHub: dmd#19998 →

Comments

Comment #0 by stanislav.blinov — 2021-10-28T05:14:26Z
import std.range; void main() { struct S { // comment this ctor to make the issue disappear this(return ref scope const S) {} void remainNestedEvenIfCtorAboveIsCommented() {} } static assert(__traits(isNested, S)); // passes static assert(isInputRange!(S[])); // fails } --- Removing the copy ctor makes the check pass, so this might be a dmd issue?.. It would seem that the problematic check in isInputRange is the is(typeof((return ref R r) => r.front)) which triggers the infamous "cannot access frame pointer", but not when the copy ctor is not present.
Comment #1 by edi33416 — 2021-11-18T17:16:59Z
IMHO, this isn't a Phobos bug. As you've already put it, it's the infamous "cannot access frame pointer" issue. Moving it to dmd.
Comment #2 by robert.schadek — 2024-12-13T19:18:56Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19998 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB