[Issue 2409] New: property is not called
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Oct 9 08:17:28 PDT 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2409
Summary: property is not called
Product: D
Version: 2.019
Platform: PC
OS/Version: Windows
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: terranium at yandex.ru
There is similar bug 2159. There property is called instead of taking
function's address. I encountered an opposite issue: property is not called and
compiler tries to apply operator to the property itself rather than to object
returned by the property. Seems like compiler desides on its own, when to call
property and when not. This is very confusing.
-----------------
alias void delegate(Object,void*) EventHandler;
class A
{
MulticastDelegate ClickHandlers;
MulticastDelegate Click()
{
return ClickHandlers;
}
}
void fun()
{
A a=new A();
EventHandler hnd;
a.Click+=hnd; //rejected should call MulticastDelegate.opAddAssign
a.Click()+=hnd; //accepted
a.ClickHandlers+=hnd; //works (field)
}
struct MulticastDelegate
{
EventHandler opAddAssign(EventHandler hnd)
{
//...add handler to invocationList...
return hnd;
}
}
------------------
--
More information about the Digitalmars-d-bugs
mailing list