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

Please clarify the specification #3985

Open
dlangBugzillaToGithub opened this issue Aug 16, 2020 · 0 comments
Open

Please clarify the specification #3985

dlangBugzillaToGithub opened this issue Aug 16, 2020 · 0 comments

Comments

@dlangBugzillaToGithub
Copy link

Victor Porton (@vporton) reported this on 2020-08-16T07:36:08Z

Transferred from https://issues.dlang.org/show_bug.cgi?id=21167

Description

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant