This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

namespace alias and using directive


Hi,
When employing a namspace alias, using directives in the aliased
namespace don't appear to be searched. Here's an example program,

namespace Foo { 
  namespace Baz {
    int i;
  }
  using namespace Baz;
}
namespace Bar = Foo;

void fn() 
{
  Foo::i = 1;
  Bar::i = 1;
} 

and here's what g++ says,
nathan@manao:1089>devel-g++ -v alias.ii 
Reading specs from /home/staff/nathan/solaris/local/sparc-SunOS_5/lib/gcc-lib/sparc-sun-solaris2.6/egcs-2.93.08/specs
gcc version egcs-2.93.08 19990219 (gcc2 ss-980929 experimental)
 /home/staff/nathan/solaris/local/sparc-SunOS_5/lib/gcc-lib/sparc-sun-solaris2.6/egcs-2.93.08/cc1plus alias.ii -quiet -version -o /var/tmp/ccLJcaaa.s
GNU C++ version egcs-2.93.08 19990219 (gcc2 ss-980929 experimental) (sparc-sun-solaris2.6) compiled by GNU C version egcs-2.91.57 19980901 (egcs-1.1 release).
alias.ii: In function `void Foo::fn()':
alias.ii:12: `i' undeclared in namespace `Bar'

The using directive works for locating Foo::Baz::i  with Foo::i, but not
when Foo's alias Bar is used.

The CD2 doesn't mention that this won't work, and the language used in defining a
namespace alias leads me to believe it should work.

Is this a bug, or more C++ namespace weirdness?

nathan
--
Dr Nathan Sidwell :: Computer Science Department :: Bristol University
      You can up the bandwidth, but you can't up the speed of light      
nathan@acm.org  http://www.cs.bris.ac.uk/~nathan/  nathan@cs.bris.ac.uk


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]