www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3451] New: Initializers don't work for tuple variables

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

           Summary: Initializers don't work for tuple variables
           Product: D
           Version: 2.035
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic, rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: clugdbug yahoo.com.au


--- Comment #0 from Don <clugdbug yahoo.com.au> 2009-10-29 08:39:03 PDT ---
Variables of tuple type can be used in assignments, but not anywhere else
(including initialization). And the error message is quite terrible.

void foo(T...)(T x) {
   T a;
   T b;
   a = x; // ok
   b = x; // ok
   T c = x; // fails
}

void main() {
   foo(1,2,3);
}
---
test.d(6): Error: cannot implicitly convert expression (tuple(_param_0,_param
1,_param_2)) of type (int, int, int) to int

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 29 2009
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3451


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|2.035                       |1.030


--- Comment #1 from Don <clugdbug yahoo.com.au> 2009-10-29 08:42:27 PDT ---
Applies to D1 as well. In 1.020 and earlier, the assignment was rejected. The
current behaviour dates from 1.028 or earlier.

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