www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8494] New: Return value for Tuple.opAssign


           Summary: Return value for Tuple.opAssign
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc

--- Comment #0 from bearophile_hugs eml.cc 2012-08-02 12:11:00 PDT ---
I'd like this operation to be supported:

import std.typecons;
int foo() {
    int[2] a;
    return a[1] = 5; // ok
int bar() {
    Tuple!(int)[2] a;
    return a[1] = tuple(5); // error
void main() {}

DMD 2.060beta4 gives:

temp.d(8): Error: cannot implicitly convert expression
(a[1u].opAssign(tuple(5))) of type void to int

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