www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21429] New: Cannot sort large tuple arrays at compile time

https://issues.dlang.org/show_bug.cgi?id=21429

          Issue ID: 21429
           Summary: Cannot sort large tuple arrays at compile time
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: maxsamukha gmail.com

import std.algorithm;
import std.typecons;

auto foo() {
    enum n = 1000;
    auto x = new Tuple!int[n];
    x.sort;
    return x;
}

enum a = foo;

void main() {
}

/dlang/dmd/linux/bin64/../../src/phobos/std/algorithm/mutation.d(2825): Error:
reinterpreting cast from Tuple!int* to ubyte* is not supported in CTFE

Compiles for n == 100.

--
Nov 26 2020