Bug 15081 – [Vector Extensions]

Status
NEW
Severity
minor
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2015-09-17T20:24:28Z
Last change time
2024-12-13T18:44:48Z
Keywords
rejects-valid
Assigned to
No Owner
Creator
Paul Buis
Moved to GitHub: dmd#19044 →

Comments

Comment #0 by 00pebuis — 2015-09-17T20:24:28Z
void axpy (float[] x, const float[] y, const float a) { x[] = a*x[] + y[]; } void axpy1 (float[] x, const float[] y, const float a) { x[] *= a; x[] += y[]; } void axpy2(float[] x, const float[] y, const float a) { size_t index = 0; for (;index < x.length; index++) { x[index] = a * x[index] + y[index]; } } axpy1 and axpy2 compile fine, but axpy only compiles if I omit the const on the "y" parameter. Error message is: Error: invalid array operation cast(const(float)[])(a * x[]) + y[] (possible missing []) Not clear to me why a*x[] is being cast to const or where the extra [] could be inserted. Seems like maybe underlying implementation doesn't support a binary operator between scalars and vectors, only an opAssign when one is const and the other isn't. It appears the scalar multiply results in a const float[] and then
Comment #1 by robert.schadek — 2024-12-13T18:44:48Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19044 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB