This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++ PATCH: Diagnose use of abstract class in function prototype
>>>>> "Gabriel" == Gabriel Dos Reis <gdr@codesourcery.com> writes:
> What happens is that at the point of definition of "z" we have an
> implicit instantiation of Z<int> which in turn triggers a declaration
> for Z<int>::g(Y, Z<int>) which is ill-formed. Currently I'm doing
> /* Recurse on nested-classes. */
> for (; nested_class; nested_class = TREE_CHAIN (nested_class))
> {
> tree nc = TREE_TYPE (nested_class);
> if (DECL_ARTIFICIAL (nested_class) && nc != t && CLASS_TYPE_P (nc)
> && COMPLETE_TYPE_P (nc))
> check_prototypes_in_class_scope (nc);
> }
> My question is: Is it correct to consider the case nested_class is a
> TEMPLATE_DECL and look for its full specializations? I guess it is but
> I need confirmation (because I've found the hard way that the
> documentation doesn't always match what effectively happens).
That sounds safe, though it makes me a bit nervous.
What would you think about implementing this checking by having
abstract_virtuals_error notice incomplete classes and add them to a list
which is then walked when we finish processing class definitions? That
would also allow us to catch problems in instantiations of templates which
are not nested within Y.
Jason