Article View: gnu.gcc.help
Article #41415Re: TEMPLATE WOES/ strange g++ behavior
From: Mark Mestern
Date: Wed, 27 Mar 1996 00:00
Date: Wed, 27 Mar 1996 00:00
34 lines
1345 bytes
1345 bytes
In <4jbjf5$qsh@groa.uct.ac.za> mmestern@cs.uct.ac.za (Mark Mestern) writes: >I've run into a problem with g++ 2.7.2 under Solaris 2.4. >I've got two seemingly equivalent pieces of code one of which produces >a parse error and the other compiles fine. The porblem only occurs >when trying to nest templates without using pointers. >A simple example follows. >--------------------------------------------------------------------------- >template class d<a<int>>; >--------------------------------------------------------------------------- >This will give a "parse error before `>'" message on the template line.. I'm posting the solution I received by email. The solution is simple and obvious (in hindsight). The compiler interprets >> as a single token rather than 2 '>' tokens. The solution is to write template class d<a<int> >; And it works. Thanks to those who responded to me. Mark
Technical Details
Message-ID:
<4jc8il$1i4@groa.uct.ac.za>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<4jbjf5$qsh@groa.uct.ac.za>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,3796bd64e6233993 X-Google-Attributes: gid11318c,public From: mmestern@cs.uct.ac.za (Mark Mestern) Subject: Re: TEMPLATE WOES/ strange g++ behavior Date: 1996/03/27 Message-ID: <4jc8il$1i4@groa.uct.ac.za> X-Deja-AN: 144494684 references: <4jbjf5$qsh@groa.uct.ac.za> organization: University of Cape Town newsgroups: gnu.gcc.help