[Issue 13564] New: nested struct destructor trying to access members of a global class fail to compile

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Oct 1 13:16:39 PDT 2014


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

          Issue ID: 13564
           Summary: nested struct destructor trying to access members of a
                    global class fail to compile
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: ace17 at free.fr

The following code used to compile, but doesn't anymore:

class Element(T)
{
  int pos;
}

class Container(T)
{
  struct Structure
  {
    ~this()
    {
      Container!int c;
      c.element.pos = 0;
    }
  }

  Element!T element;
}

void f()
{
  new Container!int ();
}

ace at ANTEC /tmp % dmd yo.d 
yo.d(13): Error: no property 'pos' for type 'Element!int'
yo.d(22): Error: template instance yo.Container!int error instantiating

It doesn't occur if "Structure" is moved out of "Container".
It doesn't occur if the destructor is replaced by a regular function.

Is this normal?

--


More information about the Digitalmars-d-bugs mailing list