bug with CTFE std.array.array ?

Kenji Hara k.hara.pg at gmail.com
Wed Jul 10 20:49:41 PDT 2013


This issue is already fixed in git head.

Kenji Hara

2013/7/11 Timothee Cour <thelastmammoth at gmail.com>

> import std.array;
>
> void main(){
>   //enum a1=[1].array;//NG: Error: gc_malloc cannot be interpreted at
> compile time
>   enum a2=" ".array;//OK
>
>   import std.string;
>   //enum a3=" ".splitLines.array;//NG
>   enum a4="".splitLines.array;//OK
>   enum a5=" ".split.array;//OK
>   //enum a6=" a ".split.array;//NG
>   import std.algorithm:filter;
>   enum a7=" a ".split.filter!(a=>true).array;
>   auto a8=" a ".split.array;
>   assert(a8==a7);
>   enum a9=[1].filter!(a=>true).array;//OK
> }
>
>
> I don't understand why the NG above fail (with Error: gc_malloc cannot be
> interpreted at compile time)
>
> furthermore, it seems we can bypass the CT error with interleaving
> filter!(a=>true) (see above), which is even weirder.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20130711/2fd2f3d6/attachment.html>


More information about the Digitalmars-d mailing list