www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/03/01/09:30:13

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
From: Bernd F <NOSilverbananaSPAM AT gmx DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Problem namespaces,templates & friends
Date: Fri, 01 Mar 2002 15:19:14 +0100
Organization: T-Online
Lines: 52
Message-ID: <3C7F8DE2.9B3133EF@gmx.de>
Mime-Version: 1.0
X-Trace: news.t-online.com 1014992360 02 7928 cLktT87SSQAXBs 020301 14:19:20
X-Complaints-To: abuse AT t-online DOT com
X-Sender: 520041811770-0001 AT t-dialin DOT net
X-Mailer: Mozilla 4.79 [en] (Win98; U)
X-Accept-Language: en
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi!

Can someone tell me, why this code doesn't compile?

//------------------------snip----------------------
namespace NspcA
{
namespace NspcB
{
template <class TempPar1, int TempPar2>
class TBeta;
} // of namespace NspcB

template <class TempPar1, int TempPar2>
class TAlpha
{
/* Line A: compiles
*/

//      friend class NspcB::TBeta<TempPar1,TempPar2>;
/* Line B: doesn't compile with error:
                                   parse error before `;' token
*/
        friend class ::NspcA::NspcB::TBeta<TempPar1,TempPar2>;
};
namespace NspcB
{
template <class TempPar1, int TempPar2>
class TBeta
{
};
} // of namespace NspcB
} // of namespace NspcA

int main()
{
        return 0;
}
//------------------------snip----------------------

When I uncomment line A and comment line B out it compiles perfectly.
Why does the way I address namespaces (absolute vs relative) influence
wether it compiles or not? Is it a compiler bug? If so: Is it known
and/or is there some way to fix it?

Compiler info:
GNU CPP version 3.0.3 (cpplib) (80386, BSD syntax)
GNU C++ version 3.0.3 (djgpp)

Thanks for any help in advance!

Bernd F.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019