[Issue 24886] New: std.typecons.Tuple does not support compatible `.tupleof` args

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Nov 27 04:40:10 UTC 2024


https://issues.dlang.org/show_bug.cgi?id=24886

          Issue ID: 24886
           Summary: std.typecons.Tuple does not support compatible
                    `.tupleof` args
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: b2.temp at gmx.com

In the following code, calls to f2 are all rejected. That is a  bit weird.

```
import std;

struct S
{
    uint a;
    uint b;
}

void f1(uint a, uint b){}
void f2(Tuple!(uint, uint) a){}

void main()
{
    S s;
    uint[2] a;

    f1(s.tupleof); // OK
    f1(a.tupleof); // OK

    f2(s.tupleof); // NG
    f2(a.tupleof); // NG
}  
```

The reason for that is obviously that D does not do implict construction. In
case D got first class citizen tuples this would have to work.

--


More information about the Digitalmars-d-bugs mailing list