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

2022-12-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=8553

Iain Buclaw  changed:

   What|Removed |Added

   Priority|P2  |P3

--


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

2012-08-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8553



--- Comment #2 from Michal Minich  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: ---


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

2012-08-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8553



--- Comment #1 from Kenji Hara  2012-08-16 02:21:34 PDT ---
(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.)

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