[Issue 21022] New: std.range.only does not work with const
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jul 7 08:35:21 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=21022
Issue ID: 21022
Summary: std.range.only does not work with const
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: major
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: andrej.mitrovich at gmail.com
-----
module test;
import std.range;
struct S
{
S[] s;
}
void main ()
{
const(S) x;
const(S)[] arr;
auto r1 = arr.chain(x.only); // fail
auto r2 = x.only.chain(arr); // also fail
}
-----
/Library/D/dmd/src/phobos/std/range/package.d(9805,23): Error: cannot
implicitly convert expression `value` of type `const(S)` to `S`
/Library/D/dmd/src/phobos/std/range/package.d(9890,57): Error: template
instance `std.range.OnlyResult!(const(S), 1LU).OnlyResult.__ctor!()` error
`Only` internally stores an Unqual instance of the type. I don't know why, but
this will obviously fail to work..
--
More information about the Digitalmars-d-bugs
mailing list