www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20795] New: [dip1000] segfault on templated opEquals


          Issue ID: 20795
           Summary: [dip1000] segfault on templated opEquals
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: mail skoppe.eu

Compile following with `dmd -dip1000` and you get a segfault in

It has been reduced with dustmite so the code might not make sense. If the
opEquals in Bar is converted from template to regular function we get a good
error message, same with the opCast in Bar. 

import std;

alias NamedArg = Tuple!Bar;

struct Foo
        VariantN!24 variant;

        bool opEquals(T)(T rhs) {

struct Bar
        bool opEquals()(Bar )
                return Gun() == Foo.init;

class Baz {
        T opCast(T)()

struct Gun
        void[24] buff;

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

        alias underlying this;

May 03 2020