[Issue 7970] New: @property does not properly disambiguate delegate properties
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Apr 22 16:18:41 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7970
Summary: @property does not properly disambiguate delegate
properties
Product: D
Version: unspecified
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: jmdavisProg at gmx.com
--- Comment #0 from Jonathan M Davis <jmdavisProg at gmx.com> 2012-04-22 16:19:41 PDT ---
This code:
import std.stdio;
alias void delegate() Callable;
class Test
{
@property Callable a()
{
return { writeln("hello"); };
}
}
void main()
{
auto t = new Test;
t.a(); // does NOT say hello
t.a()(); // this does
}
compiles and gives this output
hello
With -property, the second call to a should be illegal, but it still compiles.
And regardless of whether -property is used or not, hello only gets printed
once. The first call should call the delegate and print hello, but only the
second one is.
--
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