www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10306] New: Array ^^ operator doesn't support complex expressions

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10306

           Summary: Array ^^ operator doesn't support complex expressions
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic, rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs eml.cc 2013-06-08 14:58:04 PDT ---
import std.math;
void main() {
    double[3] a, b, c;
    double[3] r1 = (a[] - b[]) * c[]; // line 4, OK
    double[3] aux = a[] - b[]; // OK
    double[3] r2 = aux[] ^^ 2;  // OK
    double[3] r3 = (a[] - b[]) ^^ 2; // line 7, error
    double[3] r4 = (a[] - b[])[] ^^ 2; // line 8, error
}


dmd 2.064alpha gives:
temp.d(7): Error: incompatible types for ((a[] - b[]) ^^ (cast(double)2)):
'double[]' and 'double'

If you comment out line 7 you receive:
temp.d(8): Error: Array operation a[] - b[] not implemented

I'd like the ^^ array op support a complex expression as in line 4.

Also the error messages are a little confusing.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 08 2013
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10306



--- Comment #1 from bearophile_hugs eml.cc 2013-06-08 15:09:57 PDT ---
*** Issue 8588 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 08 2013