Bug 155 – Nested classes can't return delegates to their parents.

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2006-05-24T12:13:00Z
Last change time
2014-02-15T13:19:55Z
Keywords
wrong-code
Assigned to
bugzilla
Creator
sky

Comments

Comment #0 by sky — 2006-05-24T12:13:16Z
The following code is expected to print "Hello", but it fails to do so. This behavior seems independant from any compiler flags. ------------------------------------------- module nestedclass; private import std.stdio; class Foo { class Bar { void delegate() getDelegate() { return &sayHello; } } Bar bar; void sayHello() { writefln("Hello"); } this() { bar = new Bar(); } } int main(char[][] argv) { Foo foo = new Foo(); void delegate() sayHello = foo.bar.getDelegate(); writefln("This should print Hello:"); sayHello(); return 0; }
Comment #1 by bugzilla — 2006-06-30T20:25:24Z
Fixed DMD 0.162
Comment #2 by thomas-dloop — 2007-01-01T04:25:12Z