digitalmars.D.bugs - [Issue 20795] New: [dip1000] segfault on templated opEquals
- d-bugmail puremagic.com (50/50) May 03 2020 https://issues.dlang.org/show_bug.cgi?id=20795
https://issues.dlang.org/show_bug.cgi?id=20795 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 dmd.func.FuncDeclaration.setUnsafe(). 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) { variant.opEquals(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