D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 20133 - [REG2.084.0] Bogus slice assignment in recursive CTFE call
Summary: [REG2.084.0] Bogus slice assignment in recursive CTFE call
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 Linux
: P1 regression
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2019-08-15 21:46 UTC by Sönke Ludwig
Modified: 2021-11-08 20:45 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Sönke Ludwig 2019-08-15 21:46:54 UTC
The following snippet yields "Error: array length mismatch assigning `[0..1]` to `[1..3]`", although no slice assignment should be going on:

---
void bar(ref string text)
{
	text = text[1 .. $];
	string tcopy = text;
	if (tcopy.length > 0)
		bar(tcopy);
}

enum test = {
	string input = "foo";
	bar(input);
	return input;
} ();
---

Works as expected up to DMD 2.083.1.
Comment 1 RazvanN 2019-08-19 15:06:29 UTC
Introduced by: https://github.com/dlang/dmd/pull/9071
Comment 2 Dlang Bot 2021-10-27 08:03:14 UTC
@BorisCarvajal created dlang/dmd pull request #13228 "Fix Issue 20133 - [REG2.084.0] Bogus slice assignment in recursive CTFE call" fixing this issue:

- Fix Issue 20133 - [REG2.084.0] Bogus slice assignment in recursive CTFE call

https://github.com/dlang/dmd/pull/13228
Comment 3 Dlang Bot 2021-10-27 09:53:48 UTC
dlang/dmd pull request #13228 "Fix Issue 20133 - [REG2.084.0] Bogus slice assignment in recursive CTFE call" was merged into stable:

- 72087baef11a71d2c6f6ea9bde9885a860cb658c by Boris Carvajal:
  Fix Issue 20133 - [REG2.084.0] Bogus slice assignment in recursive CTFE call

https://github.com/dlang/dmd/pull/13228
Comment 4 Dlang Bot 2021-11-08 20:45:36 UTC
dlang/dmd pull request #13279 "Merge `stable` into `master`" was merged into master:

- 2d495c7c2073f7fb2234f81602dc9ec9af0c93b8 by Boris Carvajal:
  Fix Issue 20133 - [REG2.084.0] Bogus slice assignment in recursive CTFE call

https://github.com/dlang/dmd/pull/13279