[Issue 3656] New: delegate should specify 'this' decorations
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Dec 28 06:34:18 PST 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3656
Summary: delegate should specify 'this' decorations
Product: D
Version: 2.036
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: schveiguy at yahoo.com
--- Comment #0 from Steven Schveighoffer <schveiguy at yahoo.com> 2009-12-28 06:34:17 PST ---
Note, this bug applies to 2.037, but for some reason it's not in the version
list.
import std.stdio;
class A
{
void f() {}
}
void main()
{
const A a = new A;
auto g = &a.f;
writefln("%s", typeof(g).stringof);
g();
}
This outputs:
void delegate()
First, the line:
auto g = &a.f;
shouldn't compile because f cannot be called on a. However, even if f is
changed to a const function, the output is still "void delegate()", it should
be "void delegate() const".
This breaks const correctness without a cast, because I can call g, but not
a.f.
--
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