digitalmars.D.bugs - [Issue 13427] New: [REG2.066] cannot inline default argument
- via Digitalmars-d-bugs (33/33) Sep 05 2014 https://issues.dlang.org/show_bug.cgi?id=13427
https://issues.dlang.org/show_bug.cgi?id=13427 Issue ID: 13427 Summary: [REG2.066] cannot inline default argument alloca(...) Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: regression Priority: P1 Component: DMD Assignee: nobody puremagic.com Reporter: Marco.Leise gmx.de A trick that Andrei and I came up with not long ago, to use alloca as part of a default argument does not work any more. I developed this with someone on #D one night and use it everywhere I need to pass a D string to a C API. Use cases: http://forum.dlang.org/thread/i1gnlo$18g0$1 digitalmars.com#post-i1gql2:241k6o:241:40digitalmars.com https://github.com/mleise/fast/blob/master/source/fast/cstring.d#L92 ---------------8<---------------- import core.stdc.stdlib; enum allocaLimit = 1024; auto wcharPtr(alias str)(void* buffer = 2*(str.length+1) <= allocaLimit ? alloca(2*(str.length+1)) : null) { // ... } void main() { wcharPtr!"abc"w; } ------------->8---------------- --
Sep 05 2014