[Issue 22487] New: Array!T.init.data crashes
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Nov 7 16:29:40 UTC 2021
https://issues.dlang.org/show_bug.cgi?id=22487
Issue ID: 22487
Summary: Array!T.init.data crashes
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: timon.gehr at gmx.ch
CC: dandrei279 at gmail.com, maxhaton at gmail.com
The fix for issue 21100 is buggy, the following code crashes:
---
void main(){
import std.container;
Array!int a;
foreach(i;a.data){}
}
---
core.exception.AssertError at std/typecons.d(6644): Attempted to access an
uninitialized payload.
---
It should check whether the data is initialized, like most other members of
Array!T do. If the data is not initialized, it should return an empty dynamic
array.
--
More information about the Digitalmars-d-bugs
mailing list