[Issue 852] ICE(toir.c) using local class in non-static nested function in nested static function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed May 27 04:32:52 PDT 2009


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


Don <clugdbug at yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|ICE(toir.c) in dmd with     |ICE(toir.c) using local
                   |anon. delegate in static    |class in non-static nested
                   |class ctor in unittest      |function in nested static
                   |                            |function




--- Comment #3 from Don <clugdbug at yahoo.com.au>  2009-05-27 04:32:51 PDT ---
Changed name from ICE(toir.c) in dmd with anon. delegate in static class ctor
in unittest, since it has nothing to do with delegates, static class
constructors, or unittest!

This reduced test case shows that it's caused by use of new of local class,
inside a non-static function nested inside static local function. 

---
void bar() {
    class Foo { }
    static void foo() {
        void pug() {
            Foo z = new Foo; 
        }
    }
}
---

If you move the 'static' from foo to pug, you get the error:

void bar() {
    class Foo { }
    void foo() {
        static void pug() {
            Foo z = new Foo; 
        }
    }
}

ice.d(8): Error: function ice.bar is a nested function and cannot be accessed
fr
om pug
But this seems to be a rejects-valid to me -- I can't see any reason why a
static nested function couldn't access a local class.

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