www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10433] New: Array sum operation in function template

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs 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: -------
Jun 20 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10433


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
           Platform|x86                         |All
         OS/Version|Windows                     |All


--- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2013-06-20 19:47:17 PDT ---
https://github.com/D-Programming-Language/dmd/pull/2236

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



--- Comment #2 from github-bugzilla puremagic.com 2013-06-20 20:08:46 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/d964f31b54a355b6b4e268457091ecd37a87c4af
fix Issue 10433 - Array sum operation in function template

https://github.com/D-Programming-Language/dmd/commit/1adbc5f2fdd84f7c258b40f870bd95dad41b6df5
Merge pull request #2236 from 9rnsr/fix10433

Issue 10433 - Array sum operation in function template

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


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies gmail.com
         Resolution|                            |FIXED


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