[Issue 19232] ICE when overriding templated method

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Sep 7 14:49:31 UTC 2018


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

--- Comment #2 from Michael Galuza <riddlermichael at gmail.com> ---
(In reply to Simen Kjaeraas from comment #1)
> 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)

Thank you for detailed explanation! Anyway, it's ICE)

--


More information about the Digitalmars-d-bugs mailing list