digitalmars.D.bugs - [Issue 12780] New: Multiplying integer vector by scalar double fails
- via Digitalmars-d-bugs (33/33) May 21 2014 https://issues.dlang.org/show_bug.cgi?id=12780
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 puremagic.com Reporter: sfrijters 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. --
May 21 2014