[Issue 5787] Invisible multiple function calls when using .tupleof
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Mar 28 12:06:01 PDT 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5787
--- Comment #2 from kennytm at gmail.com 2011-03-28 12:02:32 PDT ---
The problem is in .tupleof, where (expr).tupleof is rewritten to
TypeTuple!((expr).field0, (expr).field1, (expr).field2, ...) even if expr have
side effect, e.g.
-----------
import std.c.stdio : printf;
struct S {
int x;
int y;
}
void main() {
cast(void)
(printf("Hi\n"), S(2,3)).tupleof;
}
// print "Hi" twice.
-----------
This should be rewritten as (tmp=expr, TypeTuple!(tmp.field0, ...)).
(The ',' here is a comma expression.)
--
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