I am using the new libcxx library and I have a code that calls the socket function bind()
. The problem is that when I type using namespace std;
the compiler gives me an error for the following code:
int res = bind(sockfd, (struct sockaddr *)&myAddr, sizeof(myAddr));
The error using clang (svn build):
error: no viable conversion from '__bind<int &, sockaddr *, unsigned long>' to 'int'
int res = bind(sockfd, (struct sockaddr *)&myAddr, sizeof(myAddr));
I think that the problem is that using namespace std;
brings the function std::bind()
from the header <functional>
to the scope (although the header is not included). As I am using a third party library that uses the entire namespace std I can't easily change the class names to fully qualified names.
I was wondering whether this is a problem in the implementation of the library or whether there are some new rules in C++11 that might potentially break an old code that uses bind()
. Any thoughts on this would be appreciated.
Thanks
Roman