[Issue 18974] ICE with mixin templates, inheritance and overloading

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jun 13 07:43:51 UTC 2018


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

Simen Kjaeraas <simen.kjaras at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice
                 CC|                            |simen.kjaras at gmail.com

--- Comment #1 from Simen Kjaeraas <simen.kjaras at gmail.com> ---
Further simplified:

template Mixin() {
    void fun(const int) { }
}

class Foo {
    mixin Mixin!();
    mixin Mixin!();
}

class Bar : Foo {
    override void fun(int) { } // Line 11
}

This gives a slightly different stack trace (top calls are still the same).
This difference is caused by templatization of Foo, and can be disregarded.

Changing the type on line 14 from A to const(A) removes the crash. Rewriting to
using a single invocation of Mixin with two function definitions inside gives
this message:

Error: function void foo.Bar.fun(A) does not override any function, did you
mean to override void foo.Foo!int.Foo.Mixin!(A, B).fun(const(A))?

--


More information about the Digitalmars-d-bugs mailing list