[Issue 21167] New: Please clarify the specification
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Aug 16 07:36:08 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=21167
Issue ID: 21167
Summary: Please clarify the specification
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P1
Component: dlang.org
Assignee: nobody at puremagic.com
Reporter: porton at narod.ru
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.
--
More information about the Digitalmars-d-bugs
mailing list