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

          Issue ID: 16542
           Summary: makeArray not usable with const initializer
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Mac OS X
            Status: NEW
          Severity: major
          Priority: P1
         Component: phobos
          Assignee: nob...@puremagic.com
          Reporter: clumsycodemon...@gmail.com

example:
---------------------------------------
void doSomething(T)(in T initialValue)
{
  T[] t = theAllocator.makeArray!T(100, initialValue); // won't compile

  T[] t2 = theAllocator.makeArray!T(100, cast()initialValue); // this one
compiles

  // ... use t and t2
}

-----------------------------------------

If all you are doing is copying the value, you shouldn't actually be changing
initialValue, so why not make it const?

--

Reply via email to