🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #2144

Re: Problems compiling template typedefs

#2144
From: Nathan Myers
Date: Sat, 07 Oct 1995 00:25
35 lines
2111 bytes
"Douglas C. Schmidt" <schmidt@cs.wustl.edu> wrote:
>	I get the following error:

>"y.C", line 17: Error: :: is not a class name as required for a qualifer.

>... when I compile the following program with SunC++ 4.0.1 and GNU G++:

> struct ACE_SOCK_Acceptor {  typedef ACE_INET_Addr PEER_ADDR; };
>
> template <class PEER_ACCEPTOR>
>  struct ACE_Acceptor {  int open (const PEER_ACCEPTOR::PEER_ADDR &addr); };

> Can anyone tell me if there are compilers available that get this right?!

Correct C++ syntax would be

  int open(const typename PEER_ACCEPTOR::PEER_ADDR& addr);

Unfortunately, I don't know of any compilers that accept the "typename"
keyword yet.  (It's a fairly recent addition.)  The "typename" keyword
is necessary to inform the lexer that the name is a type, both to help
decouple the parser from the lexer, and to permit some declarations that
would otherwise be terminally ambiguous.

Until the compilers come up to date, you will need to muddle along, doing
experiments to figure out what kind of heuristic (if any) your compiler 
uses to identify type names in such contexts.

Nathan Myers
myersn@roguewave.com


[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID: <454g2p$n8n@shellx.best.com>
Path: arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!taumet!clamage
References: <451o6v$kt8@engnews2.Eng.Sun.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!taumet!clamage
From: Nathan Myers <ncm@netcom.com>
Newsgroups: comp.std.c++
Subject: Re: Problems compiling template typedefs
Date: 7 Oct 1995 00:25:46 GMT
Organization: Best Internet Communications
Approved: clamage@eng.sun.com (comp.std.c++)
Message-ID: <454g2p$n8n@shellx.best.com>
References: <451o6v$kt8@engnews2.Eng.Sun.COM>
NNTP-Posting-Host: taumet.eng.sun.com
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"; conversions="7bit"
Content-Transfer-Encoding: 7bit
X-Nntp-Posting-Host: ncm.vip.best.com
X-Mailer: Mozilla 1.1N (X11; I; SunOS 5.4 sun4m)
X-Url: news:451o6v$kt8@engnews2.Eng.Sun.COM
X-Lines: 31
Content-Length: 1135
Originator: clamage@taumet