Watch, Follow, &
Connect with Us
Public Report
Report From: C++BuilderX/Compiler    [ Add a report in this area ]  
Report #:  10750   Status: Need Feedback
Namespace problem
Project:  C++BuilderX/BC++ 2005 Build #:  328
Version:    1.5 Submitted By:   Roman Morokutti
Report Type:  Basic functionality failure Date Reported:  2/2/2005 1:09:43 AM
Severity:    Serious / Highly visible problem Last Updated: 8/9/2014 5:01:15 PM
Platform:    All versions Internal Tracking #:  
Resolution: Need More Info (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
The compiler does not recognize namespace scope.
Here is a little example:


template<typename T>
struct abc{};

namespace foobar
{
   struct A {};
   void operator<<( abc<A> const&, char) {}
}

#ifdef __BORLANDC__
   #pragma argsused
#endif
int main( int argc, char * argv[] )
{
   abc<foobar::A> t;
   t << '0';
   return 0;
}

This code compiles with msvcpp2003 as also with mingw and
comeau online compiler.

Greetings Roman
Steps to Reproduce:
None
Workarounds
Something like:

#if(__BORLANDC__ <= 0x570)
   using namespace foobar;
#endif

inside the code.
Attachment
None
Comments

mauro russo at 8/9/2014 12:25:43 PM -

I don't think the standard allows to access
to a (named) namespace function without
the scope operator, unless 'using'.

Hence, the behavior you described is normal
and you can make the code compiling by

foobar::operator<<( t, '0' );

or, as you wrote, adding

using namespace foobar;


Server Response from: ETNACODE01