November 21, 2016 Enumerate CTFE bug... | ||||
|---|---|---|---|---|
| ||||
I'm not sure if it's the same as #15064 bug:
import std.array, std.range, std.algorithm;
immutable static foo = ["a", "b", "c"];
auto bar(R)(R r)
{
string s = r[1];
return s;
}
immutable static res = foo.enumerate.map!bar().array;
std/typecons.d(526): Error: reinterpreting cast from inout(ulong)* to inout(Tuple!(ulong, immutable(string)))* is not supported in CTFE
bug.d(9): called from here: r._Tuple_super()
std/algorithm/iteration.d(593): called from here: bar(this._input.front())
std/array.d(105): called from here: __r2091.front()
bug.d(15): called from here: array(map(enumerate(foo, 0LU)))
---
Paolo
| ||||
November 21, 2016 Re: Enumerate CTFE bug... | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Paolo Invernizzi | On Monday, 21 November 2016 at 13:22:57 UTC, Paolo Invernizzi wrote:
> I'm not sure if it's the same as #15064 bug:
>
> import std.array, std.range, std.algorithm;
>
> immutable static foo = ["a", "b", "c"];
> auto bar(R)(R r)
> {
> string s = r[1];
> return s;
> }
> immutable static res = foo.enumerate.map!bar().array;
>
> std/typecons.d(526): Error: reinterpreting cast from inout(ulong)* to inout(Tuple!(ulong, immutable(string)))* is not supported in CTFE
> bug.d(9): called from here: r._Tuple_super()
> std/algorithm/iteration.d(593): called from here: bar(this._input.front())
> std/array.d(105): called from here: __r2091.front()
> bug.d(15): called from here: array(map(enumerate(foo, 0LU)))
>
> ---
> Paolo
Yes looks like it.
Adding a special case in phobos should solve the problem.
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply