www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14404] New: Class nested within function cannot be created


          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 puremagic.com
          Reporter: matt 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:


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


Apr 03 2015