mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 21:21:48 +03:00
This commit is contained in:
parent
14874cffd8
commit
8a96c4745c
2 changed files with 14 additions and 1 deletions
|
@ -2234,7 +2234,7 @@ extern (C++) final class TypeSArray : TypeArray
|
||||||
auto elements = new Expressions(d);
|
auto elements = new Expressions(d);
|
||||||
foreach (ref e; *elements)
|
foreach (ref e; *elements)
|
||||||
e = null;
|
e = null;
|
||||||
auto ae = new ArrayLiteralExp(Loc.initial, this, elementinit, elements);
|
auto ae = new ArrayLiteralExp(loc, this, elementinit, elements);
|
||||||
return ae;
|
return ae;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -111,3 +111,16 @@ void f() @nogc
|
||||||
DA da = DA.a;
|
DA da = DA.a;
|
||||||
int i = *cast(int*)cast(char[4])['0', '0', '0', '0'];
|
int i = *cast(int*)cast(char[4])['0', '0', '0', '0'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
TEST_OUTPUT:
|
||||||
|
---
|
||||||
|
fail_compilation/nogc3.d(125): Error: this array literal causes a GC allocation in `@nogc` function `g`
|
||||||
|
---
|
||||||
|
*/
|
||||||
|
|
||||||
|
// https://github.com/dlang/dmd/issues/21054
|
||||||
|
void g() @nogc
|
||||||
|
{
|
||||||
|
int[] x = (int[2]).init[];
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue