[Issue 14421] New: Variadic args array force on heap

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Apr 7 04:14:39 PDT 2015


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

          Issue ID: 14421
           Summary: Variadic args array force on heap
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: john.loughran.colvin at gmail.com

char[] foo(char[] args ...)
{
    return args;
}

This is obviously wrong code, as args can be allocated on the stack. However,
it might not be.

Currently the only way out is to go `return args.dup` but that can lead to
allocating twice.

--


More information about the Digitalmars-d-bugs mailing list