www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20649] New: _d_arraysetlengthT crashes when

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

          Issue ID: 20649
           Summary: _d_arraysetlengthT crashes when std.traits.ReturnType
                    is used with auto function
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: menodinulla gmail.com

The following code causes `object.Error (0): Access Violation` at `ss.length =
1` on Windows 64bit.

--- app.d
import std.traits;

struct S { int i; }

auto f()
{
    S[] ss;
    ss.length = 1;
}

alias a = ReturnType!f;

void main()
{
    f();
}
---

Tested on the following versions.

- dmd-2.090.0
- dmd-2.091.0-rc.1

--
Mar 09 2020