[Bug c++/59144] weird behavior when dealing with too complicated templates and class hierarchy
daniel.kruegler at googlemail dot com
gcc-bugzilla@gcc.gnu.org
Wed Nov 20 09:25:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59144
Daniel Krügler <daniel.kruegler at googlemail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |daniel.kruegler@googlemail.
| |com
--- Comment #4 from Daniel Krügler <daniel.kruegler at googlemail dot com> ---
(In reply to tmmikolajczyk from comment #3)
> Why that's not a bug? No matter if the X::bar method is virtual or not it
> should not have any impact on access to it from the derived classes in this
> case IMHO.
If bar is not virtual, it will never be instantiated in your example code and
for the non-instantiated code no diagnostics is required. Making it virtual
provokes its instantiation irrespective of any other missing odr-usage. See
14.7.1 p11:
"An implementation shall not implicitly instantiate a function template, a
variable template, a member template, a non-virtual member function, a member
class, or a static data member of a class template that does not require
instantiation. It is unspecified whether or not an implementation implicitly
instantiates a virtual member function of a class template if the virtual
member function would not otherwise be instantiated."
In other words: You example code is not useful to demonstrate what you intend
to demonstrate.
More information about the Gcc-bugs
mailing list