Some initial diagnosis of memtemp89.C
Paul Burchard
burchard@pobox.com
Wed Sep 8 06:56:00 GMT 1999
I have started looking into the crash test memtemp89.C (reproduced
below), and have discovered at least two distinct problems with the
handling of template template parameters.
class Q {
template<class T>
class X {
};
};
template<template<class> class XX>
class Y {
XX<int> x_;
};
Y<Q::X> y;
1. The template template arg `Q::X' of `Y<Q::X>' is mis-parsed. Tthe
parser erroneously accepts `Q::X' as an expression template arg
(specifically, as the overqualified_id of a fictitious data member `X'
of class `Q'). I'm not yet sure why the template_arg => type_id
production fails (thus falling through to the undesired template_arg =>
expr_no_commas rule), since type_id => nested_type is a valid
production.
2. The function tsubst() seems to make incorrect assumptions about
template template args (the comment before the call to
lookup_template_class() is wrong, I think). More specifically, when
calling lookup_template_class() on the template template arg `Q::X', the
`context' argument should be NULL; no function context is involved.
Indeed, if I make `context' NULL, the crash goes away and gcc gives the
message "In instantiation of `Y<Q::X>': `X' is not a template" (which is
probably correct, given the erroneous parsing of this arg).
--
----------------------------------------------------------------------
Paul Burchard <burchard@pobox.com> http://www.pobox.com/~burchard/
----------------------------------------------------------------------
More information about the Gcc-bugs
mailing list