[Issue 19232] ICE when overriding templated method

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Sep 7 13:02:40 UTC 2018


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic, ice
                 CC|                            |simen.kjaras at gmail.com
            Summary|Compiler bug when override  |ICE when overriding
                   |function with template this |templated method

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

abstract class Bar {
        void get(A)() { }
}

class Foo : Bar {
        override void get() { }
}

unittest {
        Bar foo = new Foo();
        foo.get();
}

Now, this shouldn't actually work, since template methods are implicitly final
(and can't be made virtual in any way). If Bar.get is made into a final,
non-templated method, you get the message `Foo.get cannot override final
function Bar.get`. The correct error message in this case would be `Foo.get
cannot override template function Bar.get`.

(note that the stack trace on the ICE varies wildly with changes in the code
above - adding or removing template-ness of Foo and Bar, as well as removing
the Unknown class, completely changes it. This could thus be an issue in more
than one source code location)

--


More information about the Digitalmars-d-bugs mailing list