[Issue 14404] New: Class nested within function cannot be created

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Apr 3 12:32:02 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14404

          Issue ID: 14404
           Summary: Class nested within function cannot be created
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: critical
          Priority: P1
         Component: druntime
          Assignee: nobody at puremagic.com
          Reporter: matt at argylelabco.at

Created attachment 1506
  --> https://issues.dlang.org/attachment.cgi?id=1506&action=edit
Minimal Code Sample

Calling ClassInfo.Create will fail for a class nested within a function.
Minimal code to reproduce the issue follows:

[CODE]

extern (C) Object _d_newclass(const TypeInfo_Class ci);

void main()
{
    int kittens;
    class Foo {
        this() { kittens = 1; }
        ~this() { kittens = 0; }
    }
    Foo f = new Foo();  // this works

    typeid(f).create(); // fails

}
[/CODE]

--


More information about the Digitalmars-d-bugs mailing list