[Issue 4099] New: Inconsistent behaviour of ++/-- when mixing opUnary and 'alias this'.
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Apr 17 05:13:10 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4099
Summary: Inconsistent behaviour of ++/-- when mixing opUnary
and 'alias this'.
Product: D
Version: unspecified
Platform: x86
OS/Version: Windows
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: a3471210 at owlpic.com
--- Comment #0 from a3471210 at owlpic.com 2010-04-17 05:13:08 PDT ---
In the following example, ++x calls opUnary while x++ is performed on x
directly:
struct X
{
int x;
alias x this;
typeof(this) opUnary (string operator) ()
{
writeln ("operator called");
return this;
}
}
unittest
{
X x;
++x; //operator called
auto y = x++; //BUG! (alias this used. returns int)
}
--
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