mirror of
https://github.com/dlang/dmd.git
synced 2025-04-25 20:50:41 +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);
|
||||
foreach (ref e; *elements)
|
||||
e = null;
|
||||
auto ae = new ArrayLiteralExp(Loc.initial, this, elementinit, elements);
|
||||
auto ae = new ArrayLiteralExp(loc, this, elementinit, elements);
|
||||
return ae;
|
||||
}
|
||||
|
||||
|
|
|
@ -111,3 +111,16 @@ void f() @nogc
|
|||
DA da = DA.a;
|
||||
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