Thread overview
[Issue 20795] [dip1000] segfault on templated opEquals
May 04, 2020
Dlang Bot
May 04, 2020
Dlang Bot
May 03, 2020
https://issues.dlang.org/show_bug.cgi?id=20795

moonlightsentinel@disroot.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |moonlightsentinel@disroot.o
                   |                            |rg
           Hardware|x86_64                      |All
                 OS|Linux                       |All

--- Comment #1 from moonlightsentinel@disroot.org ---
Reduced example:

struct Foo
{
    void opEquals(T)(T rhs) if (T.init.opCast!string) {}
}

struct Bar
{
    void opEquals()(Bar)
    {
        Gun() == Foo.init;
    }
}

class Baz
{
    void opCast(T)() {}
}

struct Gun
{
    void[24] buff;

    auto underlying()
    {
        return cast(Baz) buff.ptr;
    }

    alias underlying this;
}

struct Tuple
{
    Bar expand;

    void opEquals(R)(R) if (mixin("Tuple.init.expand == R.init")) {}
}

--
May 03, 2020
https://issues.dlang.org/show_bug.cgi?id=20795

--- Comment #2 from moonlightsentinel@disroot.org ---
(In reply to moonlightsentinel from comment #1)
Tuple isn't required:

struct Foo
{
    void opEquals(T)(T rhs) if (T.init.opCast!string) {}
}

struct Bar
{
    void opEquals()(Bar)
    {
        Gun() == Foo.init;
    }
}

class Baz
{
    void opCast(T)() {}
}

struct Gun
{
    void[24] buff;

    auto underlying()
    {
        return cast(Baz) buff.ptr;
    }

    alias underlying this;

    void opEquals(R)(R) if (mixin("Bar.init == R.init")) {}
}

--
May 04, 2020
https://issues.dlang.org/show_bug.cgi?id=20795

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #3 from Dlang Bot <dlang-bot@dlang.rocks> ---
@RazvanN7 created dlang/dmd pull request #11096 "Fix Issue 20795 - [dip1000] segfault on templated opEquals" fixing this issue:

- Fix Issue 20795 - [dip1000] segfault on templated opEquals

https://github.com/dlang/dmd/pull/11096

--
May 04, 2020
https://issues.dlang.org/show_bug.cgi?id=20795

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #11096 "Fix Issue 20795 - [dip1000] segfault on templated opEquals" was merged into stable:

- bb64fe491abd5f09ebd6aaabf4c7f47ec9a39c36 by RazvanN7:
  Fix Issue 20795 - [dip1000] segfault on templated opEquals

https://github.com/dlang/dmd/pull/11096

--