[Issue 4838] Cannot declare a delegate variable for const member functions
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Sep 8 02:21:43 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4838
Don <clugdbug at yahoo.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |clugdbug at yahoo.com.au
--- Comment #3 from Don <clugdbug at yahoo.com.au> 2010-09-08 02:21:14 PDT ---
(In reply to comment #2)
> Okay, bearophile, here you go:
>
> ---
> class A {
> void foo() const {}
> }
>
> void main() {
> A a = new A;
>
> pragma( msg, typeof( &a.foo ) ); // Yields »void delegate() const«
> void delegate() const dg = &a.foo; // Does not compile.
> }
> ---
>
> The error message for this simple case is »test.d(9):
> const/immutable/shared/inout attributes are only valid for non-static member
> functions
> «.
Change that last line to:
const void delegate() dg = &a.foo;
and it works.
It's a parsing issue. I'm sure it's a dup of another bug.
--
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