Article View: comp.std.c++
Article #2131Problems compiling template typedefs
From: Douglas C. Schmidt
Date: Thu, 05 Oct 1995 23:02
Date: Thu, 05 Oct 1995 23:02
61 lines
1890 bytes
1890 bytes
Hi,
I get the following error:
----------------------------------------
% CC y.C
"y.C", line 17: Error: :: is not a class name as required for a qualifer.
"y.C", line 17: Error: ")" expected instead of "&".
2 Error(s) detected.
----------------------------------------
When I compile the following program with SunC++ 4.0.1 and GNU G++
2.7.0:
----------------------------------------
class ACE_INET_Addr {};
class ACE_SOCK_Acceptor
{
public:
typedef ACE_INET_Addr PEER_ADDR;
};
template <class PEER_ACCEPTOR>
class ACE_Acceptor
{
public:
int open (const PEER_ACCEPTOR::PEER_ADDR &addr);
};
template <class PEER_ACCEPTOR> int
ACE_Acceptor<PEER_ACCEPTOR>::open (const PEER_ACCEPTOR::PEER_ADDR &addr) { retu
rn 1; }
^^^^^^^
Error is here...
main ()
{
ACE_Acceptor<ACE_SOCK_Acceptor> acceptor;
ACE_INET_Addr addr;
acceptor.open (addr);
return 0;
}
----------------------------------------
Note that if I declare open() in the class definition then the SunC++
compiler doesn't complain.
I believe this should be acceptable C++ template syntax, right? Can
anyone tell me if there are compilers available that get this right?!
Thanks,
Doug
[ 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:
<451o6v$kt8@engnews2.Eng.Sun.COM>Path:
arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!taumet!clamageShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!taumet!clamage From: "Douglas C. Schmidt" <schmidt@cs.wustl.edu> Newsgroups: comp.std.c++ Subject: Problems compiling template typedefs Date: 5 Oct 1995 23:02:55 GMT Organization: ? Approved: clamage@eng.sun.com (comp.std.c++) Message-ID: <451o6v$kt8@engnews2.Eng.Sun.COM> NNTP-Posting-Host: taumet.eng.sun.com Content-Type: text Content-Length: 1179 X-Lines: 57 Originator: clamage@taumet