www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17371] New: [REG 2.074.0] di generation broken for anonymous

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

          Issue ID: 17371
           Summary: [REG 2.074.0] di generation broken for anonymous
                    classes
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: doob me.com

Generating a .di file with 2.074.0 from the following code generates a broken
file:

interface Foo {}

class Bar
{
    this()
    {
        auto foo = new class () Foo {};
    }
}

The generated result is:

interface Foo 
{
}
class Bar
{
    this()
    {
        auto foo = new class class __anonclass1 : Foo
        {
        }
        ;
    }
}

The generated code for the anonymous class is clearly broken. With 2.073.1 the
following code is generated:

interface Foo
{
}
class Bar
{
    this();
}

I suspect that generating the code for an anonymous class has always been
broken, as the following example shows, generated with 2.073.1:

Original code:

interface Foo
{
}

const foo = new class () Foo {};

Generated code:

interface Foo
{
}
const foo = new class class __anonclass1 : Foo
{
}
;

Not sure if this is technically a regression but it broke my code switching to
2.074.0.

--
May 05 2017