[Issue 10004] New: tuple comparison with side-effect should work
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Apr 28 19:57:31 PDT 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 at puremagic.com
ReportedBy: k.hara.pg at gmail.com
--- Comment #0 from Kenji Hara <k.hara.pg at 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: -------
More information about the Digitalmars-d-bugs
mailing list