[Issue 4838] Cannot declare a delegate variable for const member functions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Sep 8 06:25:39 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4838


Steven Schveighoffer <schveiguy at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schveiguy at yahoo.com


--- Comment #5 from Steven Schveighoffer <schveiguy at yahoo.com> 2010-09-08 06:25:16 PDT ---
Yes, it does:

import std.stdio;

class A
{
    void f() const {}
}

void main()
{
    A a = new A;
    auto g1 = &a.f;
    writefln("g1 = %s", typeof(g1).stringof);
    const void delegate() g2 = &a.f;
    writefln("g2 = %s", typeof(g2).stringof);
    void delegate() g3 = &a.f;
    writefln("g3 = %s", typeof(g3).stringof);
    g1();
    g2();
    g3();
}

compiles and outputs:

g1 = void delegate() const
g2 = const(void delegate())
g3 = void delegate()


It appears that you can remove the const decorations at will.  This is very not
good.

-- 
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