indexing a tuple containing a struct strange result

cal callumenator at gmail.com
Sun Jun 23 23:11:17 PDT 2013


On Monday, 24 June 2013 at 05:31:29 UTC, Ali Çehreli wrote:
> On 06/23/2013 10:07 PM, Ali Çehreli wrote:
>
> > I think it is a compiler bug.
>
> Make that a Phobos bug. :)
>
> The following is a reduced program that exhibits the problem. 
> The presence or absence of the unused member function makes a 
> difference:
>
> import std.typecons;
>
> struct S
> {
>     int x;
>
>     // Bizarre: Comment-out this function to pass the assert in 
> main.
>     Tuple!(S) unused()
>     {
>         return tuple(S(7));
>     }
> }
>
> void main()
> {
>     auto s = S(8);
>
>     assert(tuple(s).expand[0] == S(8));
> }
>
> Ali

Actually I hadn't tried with free functions, but this test 
captures my problem. I'll file it now. Thanks!


More information about the Digitalmars-d-learn mailing list