www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14421] New: Variadic args array force on heap


          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 puremagic.com
          Reporter: john.loughran.colvin 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.

Apr 07 2015