Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

std.typecons.Tuple does not support compatible .tupleof args #10569

Closed
dlangBugzillaToGithub opened this issue Nov 27, 2024 · 1 comment
Closed

Comments

@dlangBugzillaToGithub
Copy link

b2.temp reported this on 2024-11-27T04:40:10Z

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

CC List

Description

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.
@LightBender LightBender removed the P1 label Dec 6, 2024
@pbackus
Copy link
Contributor

pbackus commented Mar 11, 2025

This is not a Phobos bug. std.typecons.Tuple is supposed to do implicit construction, and the given example is not supposed to compile.

Whether or not this will or won't work if/when D gets built-in tuples is irrelevant to Phobos and std.typecons.Tuple.

@pbackus pbackus closed this as completed Mar 11, 2025
@pbackus pbackus closed this as not planned Won't fix, can't repro, duplicate, stale Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants