digitalmars.D.bugs - [Issue 22446] New: isInputRange fails to recognize range if element
- d-bugmail puremagic.com (31/31) Oct 27 2021 https://issues.dlang.org/show_bug.cgi?id=22446
https://issues.dlang.org/show_bug.cgi?id=22446 Issue ID: 22446 Summary: isInputRange fails to recognize range if element type is nested struct that has a copy ctor Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: phobos Assignee: nobody puremagic.com Reporter: stanislav.blinov gmail.com 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. --
Oct 27 2021