dmd/compiler/test/fail_compilation/test24159.d
Teodor Dutu b9f8e7cf24
Fix Issue 24159: Store lowering of CatAssignExp in a separate field (#15791)
This preserves the `CatAssignExp` in the AST until the glue layer where
an error is printed in case this expression is used with `-betterC`.
This is required to happen in the glue layer as the semantic analysis
doesn't correctly distinguish when code needs to be generated.

Signed-off-by: Teodor Dutu <teodor.dutu@gmail.com>
2023-11-13 13:06:02 +02:00

14 lines
288 B
D

// https://issues.dlang.org/show_bug.cgi?id=24159
// REQUIRED_ARGS: -betterC
/*
TEST_OUTPUT:
---
fail_compilation/test24159.d(13): Error: appending to array in `x ~= 3` requires the GC which is not available with -betterC
---
*/
extern(C) void main()
{
int[] x = null;
x ~= 3;
}