Bug 10004 – tuple comparison with side-effect should work

Status
RESOLVED
Resolution
FIXED
Severity
blocker
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-04-28T19:57:00Z
Last change time
2013-05-10T17:35:54Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
k.hara.pg

Comments

Comment #0 by k.hara.pg — 2013-04-28T19:57:30Z
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
Comment #1 by k.hara.pg — 2013-04-28T20:32:01Z
Comment #2 by github-bugzilla — 2013-05-05T09:50:26Z
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