[Issue 10433] New: Array sum operation in function template

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jun 20 15:43:40 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10433

           Summary: Array sum operation in function template
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic, rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2013-06-20 15:43:39 PDT ---
void foo(T)(in int[] V1, in T V2) {
    int[2] R;
    R[] = V1[] + V2[];
}
void main() {
    immutable int[] V = [10, 20];
    foo(V, V);
}


DMD 2.064alpha gives:

test.d(3): Error: invalid array operation R[] = V1[] + cast(const(int)[])V2[]
(did you forget a [] ?)
test.d(7): Error: template instance test1.foo!(immutable(int)[]) error
instantiating


I am not sure, but I think that code should compile.

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


More information about the Digitalmars-d-bugs mailing list