C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

a problem relate to namespace and using

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
Li Daobing
Guest





PostPosted: Wed Jun 21, 2006 9:10 am    Post subject: a problem relate to namespace and using Reply with quote



Hello, I want to know whether the following program is legal. the
g++-4.1 can not compile it

$ g++ -c bug2.cpp
bug2.cpp:8: error: expected unqualified-id before '}' token
bug2.cpp:15: error: 'A' is already declared in this scope
bug2.cpp:20: error: prototype for 'void n1::B::foo(const
n1::n2::A&)' does not match any in class 'n1::B'
bug2.cpp:6: error: candidate is: void n1::B::foo(const n1::A&)
$

// begin bug2.cpp
// #include "b.hpp"
namespace n1 {
class A;
class B {
void foo(const A&);
}
}

// #include "a.hpp"
namespace n1 {
namespace n2 {
class A {};
}
using n2::A;
}

// b.cpp
namespace n1 {
void B::foo(const A&) {
return;
}
}
// end
Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.