This is the mail archive of the 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]

Re: [cxx-conversion] Support garbage-collected C++ templates

On Wed, Aug 8, 2012 at 4:47 PM, Gabriel Dos Reis
<> wrote:

> So, if the issue that the function does not exist at the point of the template
> definition, but will definitely exist at the point where it is instantiated
> because of inclusion of a header file (later or in a different
> translation unit),
> then the usual way is to write no declaration at all.  The compiler will perform
> a lookup at the point of instantiation and resolve the name
> appropriate, or error.

> you can just write:
> void gt_pch_nx (TP<T> *tp)
> {
>      /* This marks field 'fld' of type 'T'.  */
>      gt_pch_nx (tp->fld);
> }

Oh, but if I do that I get the error

In file included from tree.h:29:0,
                 from cp/tree.c:28:
vec.h: In instantiation of 'void gt_ggc_mx(vec_t<T>*) [with T = tree_node*]':
./gt-cp-tree.h:571:59:   required from here
vec.h:180:5: error: no matching function for call to 'gt_ggc_mx(tree_node*&)'
     gt_ggc_mx (v->vec[i]);

Because no declaration for gt_ggc_mx(tree_node *) exists at that
point.  It will exist in some other header file that's been generated
by gengtype (which is included at the *end* of the .c file).


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