Thread overview
[Issue 10004] New: tuple comparison with side-effect should work
Apr 29, 2013
Kenji Hara
Apr 29, 2013
Kenji Hara
May 11, 2013
Kenji Hara
April 29, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10004

           Summary: tuple comparison with side-effect should work
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: blocker
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: k.hara.pg@gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg@gmail.com> 2013-04-28 19:57:30 PDT ---
By fixing issue 9873, built-in tuple comparison would be allowed from 2.063.

So this code should work, but doesn't.

extern(C) int printf(const char*, ...);
struct SZ(T...) { T field; alias field this; }
S make(S)() {
    printf("make\n");   // necessary to make this function impure
    S s;
    return s;
}
void main()
{
    struct SX(T...) { T field; alias field this; }
    alias S = SX!(int, long);
    assert(make!S.field == make!S.field);  // tuple comparison
}

Output:

test.d(14): Error: expression ref SX!(int, long) __tup5 = make();
 , (ref SX!(int, long) __tup6 = make();
) of type void does not have a boolean value

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 29, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10004


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull


--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2013-04-28 20:32:01 PDT ---
https://github.com/D-Programming-Language/dmd/pull/1947

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 05, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10004



--- Comment #2 from github-bugzilla@puremagic.com 2013-05-05 09:50:26 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/4f0929d3d9355967544da22a785a7632020d5e39 fix Issue 10004 - tuple comparison with side-effect should work

https://github.com/D-Programming-Language/dmd/commit/b7b1fc60712bb2894375a5a49fc144af7ff10bc7 Merge pull request #1947 from 9rnsr/fix10004

Issue 10004 - tuple comparison with side-effect should work

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 11, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10004


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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