Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Bugzilla 23803 - compile-time error for concatenation in -betterC #17492

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/src/dmd/e2ir.d
Original file line number Diff line number Diff line change
Expand Up @@ -1742,7 +1742,7 @@
*/
if (!irs.params.useGC)
{
irs.eSink.error(ce.loc, "array concatenation of expression `%s` requires the GC which is not available with -betterC", ce.toChars());
irs.eSink.error(ce.loc, "`%s` is not allowed in -betterC mode because it requires the garbage collector.", ce.toChars());

Check warning on line 1745 in compiler/src/dmd/e2ir.d

View check run for this annotation

Codecov / codecov/patch

compiler/src/dmd/e2ir.d#L1745

Added line #L1745 was not covered by tests
return el_long(TYint, 0);
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/test/fail_compilation/test18312.d
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
REQUIRED_ARGS: -betterC
TEST_OUTPUT:
---
fail_compilation/test18312.d(14): Error: array concatenation of expression `"[" ~ s ~ "]"` requires the GC which is not available with -betterC
fail_compilation/test18312.d(14): Error: `"[" ~ s ~ "]"` is not allowed in -betterC mode because it requires the garbage collector.
---
*/

Expand Down
2 changes: 1 addition & 1 deletion compiler/test/fail_compilation/test23710.d
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* REQUIRED_ARGS: -betterC
TEST_OUTPUT:
---
fail_compilation/test23710.d(111): Error: array concatenation of expression `foo ~ [1, 2, 3]` requires the GC which is not available with -betterC
fail_compilation/test23710.d(111): Error: `foo ~ [1, 2, 3]` is not allowed in -betterC mode because it requires the garbage collector.
---
*/
// https://issues.dlang.org/show_bug.cgi?id=23710
Expand Down
20 changes: 20 additions & 0 deletions compiler/test/fail_compilation/test23803.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// https://issues.dlang.org/show_bug.cgi?id=23803

/*
REQUIRED_ARGS: -betterC
TEST_OUTPUT:
---
fail_compilation/test23803.d(14): Error: `a ~ b` is not allowed in -betterC mode because it requires the garbage collector.
---
*/

string foo()
{
string a, b;
return a ~ b;
}

extern(C) void main()
{
foo();
}
Loading