www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17632] New: 2.075 beta regression: opBinary and delegate code

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

          Issue ID: 17632
           Summary: 2.075 beta regression: opBinary and delegate code
                    generation
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: briancschott gmail.com

The following code executes successfully with 2.074.1 but segmentation faults
with 2.075.0-b4:

----------------------------------------------------

import std.stdio;

struct Test
{
    void delegate() testBody;
    Exception unexpected;

    void opBinary(string op)(void delegate() fun)
    {
        testBody = fun;

        // Call it
        try
            testBody();
        catch (Exception ex)
            unexpected = ex;
    }
}

struct URL
{
    string fragment;

}

struct JsonCube
{
    URL dataURL;
}

struct JsonCubeDef
{
    JsonCube _def;
    this(string)
    {
    }
}

immutable TEST_JSON = `{}`;

void main()
{
    auto def = cast(immutable) JsonCubeDef(TEST_JSON);

    Test() in
    { writeln(def); };
}

--
Jul 10 2017