This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/33878] Pure virtual method body omitted from template



------- Comment #5 from bangerth at dealii dot org  2008-03-31 19:54 -------
(In reply to comment #0)
> The following stripped down code shows pure virtual method definitions for both
> a normal base class and a templated base class. To my surprise, the templated
> class' body is not generated,

Your example code contains neither a call to TBase<int>::pvMethod (which would
trigger an implicit instantiation of this function from its template) nor an
explicit instantiation of either the entire class or of this function.
Consequently, the compiler doesn't instantiate your template.

If you intend to call TBase<int>::pvMethod from somewhere where the definition
of this template is not visible, you need to add an explicit instantiation of
this function for 'int' as the template arg.

W.


-- 

bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bangerth at dealii dot org
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33878


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]