[Issue 12780] New: Multiplying integer vector by scalar double fails
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed May 21 07:08:16 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=12780
Issue ID: 12780
Summary: Multiplying integer vector by scalar double fails
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: minor
Priority: P1
Component: DMD
Assignee: nobody at puremagic.com
Reporter: sfrijters at gmail.com
void main() {
int ifoo = 2;
int[3] ibar = 1;
double dfoo = 2.0;
double[3] dbar = 1.0;
dfoo = ifoo * dfoo; // Scalar int * scalar double -- OK
dfoo = dfoo * dfoo; // Scalar double * scalar double -- OK
dbar = dfoo * dbar[]; // Scalar double * array of double --
OK
ibar = ifoo * ibar[]; // Scalar int * array of int -- OK
dbar = ifoo * dbar[]; // Scalar int * array of double -- OK
dbar = dfoo * ibar[]; // Scalar double * array of int -- FAIL
}
I would have expected the last case to work as well, but I get
testarr.d(13): Error: incompatible types for ((dfoo) * (ibar[])):
'double' and 'int[]'
Discussion at
http://forum.dlang.org/thread/uxuhzwkefamcnqsbwctp@forum.dlang.org suggests
that this an unnecessary restriction and could be lifted.
--
More information about the Digitalmars-d-bugs
mailing list