------- Comment #18 from bangerth at math dot tamu dot edu 2008-04-02 18:34 ------- Subject: Re: Pure virtual method body omitted from template
> You are absolutely right as long as there is no multithreading and no > dangling pointer. Sure. The thing is: If it's called, something bad has > occured I see your point, but in a case like this you are working outside what the standard says (it would call the program erroneous and its actions 'undefined'). The compiler's job being to translate what the standard describes, you can't rely on any such behavior. > * For templates the method is not generated, and we've discussed why. It's > due to the template function emission rules: Not called, not emitted. But > there is also the shortcut rule when deriving: Cannot be called, not > emitted. That is what you explained. Thus here you have no choice. You can instantiate explicitly if you want this. By the way, there is also a rule somewhere in the standard that says that only those templates must be instantiated that are actually needed; in other words, the compiler cannot instantiate more functions just because someone may want it to be there -- the functions must actually be *needed* for the program to work correctly. W. ------------------------------------------------------------------------- Wolfgang Bangerth email: [EMAIL PROTECTED] www: http://www.math.tamu.edu/~bangerth/ -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33878