[Issue 8553] templated interface methods (virutal?) and linker missing symbols

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Aug 16 02:31:49 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8553



--- Comment #2 from Michal Minich <michal.minich at gmail.com> 2012-08-16 02:31:46 PDT ---
(In reply to comment #1)
> (In reply to comment #0)
> > are currently templated virutal members supprted? Anyway ... it should not
> > result in linker error.
> 
> Today, you can declare template function in interface, but it is treated as
> final implicitly. Because template function cannot be virtual.
> 
> So, in the code
> 
> >    k.accept (new Visitor!int);
> 
> IKlazz.accept is always called instead of KlazzDeriv.accept, but its
> implementation is not there, so linker error occurs.
> 
> Therefore, this is not a bug, but compiler should more better error message.
> (I think compiler should enforce adding 'final' keyword to IKlazz.accept.)

Also it seems that templated methods in abstract class are treated as final
implicitly. But there is, at least, little bit cryptic message "non-virtual
functions cannot be abstract". So it seems the compiler applies hidden "final"
attribute an the method declaration. I think compiler should enforce explicit
"final" attribute to be declared by user on the method.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list