Undefined symbol for, apparently, valid code?
H. S. Teoh via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Jul 6 09:16:17 PDT 2017
On Thu, Jul 06, 2017 at 06:28:11AM +0000, unleashy via Digitalmars-d-learn wrote:
> Hello. I am trying to compile this:
>
> ---
> module asd.asd;
>
> abstract class Asd
> {
> void opCall(Args...)(Args args);
> }
>
> @system unittest
> {
> class Foo : Asd
> {
> override void opCall(Args...)(Args args)
> {
> /* nothing */
> }
> }
>
> Asd a = new Foo();
>
> a(1, 2, 3);
> }
> ---
[...]
Template functions cannot be virtual, and it's invalid to override a
non-virtual function.
Which version of the compiler are you using? I just tested on the
latest dmd git HEAD, and it (correctly) tells me that it's illegal to
override a non-virtual function. I'm surprised you got your code to
compile at all.
T
--
My program has no bugs! Only unintentional features...
More information about the Digitalmars-d-learn
mailing list