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

Parsing templates as baseclasses


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


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