D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 21167 - Please clarify the specification
Summary: Please clarify the specification
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: dlang.org (show other issues)
Version: D2
Hardware: All All
: P4 enhancement
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-16 07:36 UTC by Victor Porton
Modified: 2024-12-15 15:26 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Victor Porton 2020-08-16 07:36:08 UTC
https://dlang.org/spec/arrays.html 12.9.4 "The slice on the left and any slices on the right must not overlap."

Please clarify what this means and give an example of an error.

The following compiles and runs without errors despite left and right overlap (in fact they are the same):

void main() {
  auto a = [3.0, 2.7, 3.4];
  auto b = [2.3, 1.4, 2.5];
  a[] = a[] + a[];
}

Is the above an undefined behavior? In this case, the spec should explicitly mention undefined behavior and the compiler should give an error/warning.
Comment 1 dlangBugzillaToGithub 2024-12-15 15:26:30 UTC
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dlang.org/issues/3985

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB