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]

Re: c++/1917


http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=1917&database=gcc


Just to follow-up on this bug, I did a little searching.
It looks like this piece of code (from instantiate_template in pt.c)
expects
all the tree that are referenced into the TREE_CHAIN of a TEMPLATE_DECL
to be 
TEMPLATE_DECLs as well (as alternate entry points of the function from
the comment).

  /* If we've just instantiated the main entry point for a function,
     instantiate all the alternate entry points as well.  */
  for (clone = TREE_CHAIN (gen_tmpl);
       clone && DECL_CLONED_FUNCTION_P (clone);
       clone = TREE_CHAIN (clone))
    instantiate_template (clone, targ_ptr);

On the other hand, the pushdecl function (from decl.c) called from
push_template_decl_real just chains
the template with the other decls of the file (?) and here the previous
decl of template function sqr
is the synthetized destructor of class C. Since this is a FUNCTION_DECL
and since the first thing that
does the instantiate_template from the loop above is to check that the
tree passed is indeed a TEMPLATE_DECL,
we have the ICE.

I have looked throught the documentation to understand what should be in
the TREE_CHAIN, but I have not seen
anything, so I guess that's as far as I can go without some help.


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