This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Parsing templates as baseclasses
- To: egcs at cygnus dot com
- Subject: Parsing templates as baseclasses
- From: Martin von Loewis <martin at mira dot isdn dot cs dot tu-berlin dot de>
- Date: Mon, 2 Mar 1998 00:59:29 +0100
I'm trying to investigate the code
namespace foo {
template <class T>
class x {};
}
class y : public foo::x<int> {};
I've got the lexer to produce, for the last line
(AGGR `class') (IDENTIFIER_DEFN `y')
(':')(VISSPEC)
(NSNAME)(SCOPE)
(PTYPENAME `x')('<')(TYPESPEC `int')('>')
('{')
The last line is eventually reduced -> template_type.
Then I get an error with the stack
state stack now 0 1 4 66 222 223 466 717 958 123
In the non-namespace case, the template_type is further reduced
-> type_name -> nonnested_type -> base_class.1
Now, where should I put the support for namespace-qualified template
types? I'll have to eventually reduce this to baseclass.1 as well,
preferably without declaring foo::x<int> a nested type (it isn't).
Also, I'd like to avoid additional conflicts in the grammar.
Any guidance appreciated.
Martin