Commit 436ea0e5 by Jonathan Wakely Committed by Jonathan Wakely

Rename namespace alias in test to avoid name collision

	* testsuite/experimental/net/internet/address/v4/creation.cc: Do not
	declare ip in global namespace, to avoid collision with struct ip
	defined in <netinet/ip.h>.

From-SVN: r265205
parent a70a4be9
2018-10-16 Jonathan Wakely <jwakely@redhat.com> 2018-10-16 Jonathan Wakely <jwakely@redhat.com>
* testsuite/experimental/net/internet/address/v4/creation.cc: Do not
declare ip in global namespace, to avoid collision with struct ip
defined in <netinet/ip.h>.
* include/experimental/bits/net.h: Move versioned namespace macros * include/experimental/bits/net.h: Move versioned namespace macros
to correct location. to correct location.
* include/experimental/buffer: Likewise. * include/experimental/buffer: Likewise.
......
...@@ -21,8 +21,8 @@ ...@@ -21,8 +21,8 @@
#include <experimental/internet> #include <experimental/internet>
#include <testsuite_hooks.h> #include <testsuite_hooks.h>
namespace ip = std::experimental::net::ip; namespace net = std::experimental::net;
using ip::address_v4; using net::ip::address_v4;
void void
test01() test01()
...@@ -44,12 +44,12 @@ test02() ...@@ -44,12 +44,12 @@ test02()
{ {
bool test __attribute__((unused)) = false; bool test __attribute__((unused)) = false;
auto a0 = ip::make_address_v4(0u); auto a0 = net::ip::make_address_v4(0u);
VERIFY( a0.to_uint() == 0 ); VERIFY( a0.to_uint() == 0 );
VERIFY( a0.to_bytes() == address_v4::bytes_type{} ); VERIFY( a0.to_bytes() == address_v4::bytes_type{} );
address_v4::uint_type u1 = ntohl((5 << 24) | (6 << 16) | (7 << 8) | 8); address_v4::uint_type u1 = ntohl((5 << 24) | (6 << 16) | (7 << 8) | 8);
auto a1 = ip::make_address_v4( u1 ); auto a1 = net::ip::make_address_v4( u1 );
VERIFY( a1.to_uint() == u1 ); VERIFY( a1.to_uint() == u1 );
VERIFY( a1.to_bytes() == address_v4::bytes_type( 5, 6, 7, 8 ) ); VERIFY( a1.to_bytes() == address_v4::bytes_type( 5, 6, 7, 8 ) );
} }
...@@ -59,27 +59,27 @@ test03() ...@@ -59,27 +59,27 @@ test03()
{ {
bool test __attribute__((unused)) = false; bool test __attribute__((unused)) = false;
auto a1 = ip::make_address_v4("127.0.0.1"); auto a1 = net::ip::make_address_v4("127.0.0.1");
VERIFY( a1.is_loopback() ); VERIFY( a1.is_loopback() );
auto a2 = ip::make_address_v4(std::string{"127.0.0.2"}); auto a2 = net::ip::make_address_v4(std::string{"127.0.0.2"});
VERIFY( a2.is_loopback() ); VERIFY( a2.is_loopback() );
auto a3 = ip::make_address_v4(std::experimental::string_view{"127.0.0.3"}); auto a3 = net::ip::make_address_v4(std::experimental::string_view{"127.0.0.3"});
VERIFY( a3.is_loopback() ); VERIFY( a3.is_loopback() );
std::error_code ec; std::error_code ec;
auto a4 = ip::make_address_v4("127...1", ec); auto a4 = net::ip::make_address_v4("127...1", ec);
VERIFY( ec == std::errc::invalid_argument ); VERIFY( ec == std::errc::invalid_argument );
ip::make_address_v4("127.0.0.1", ec); net::ip::make_address_v4("127.0.0.1", ec);
VERIFY( !ec ); VERIFY( !ec );
a4 = ip::make_address_v4(std::string{"256.0.0.1"}, ec); a4 = net::ip::make_address_v4(std::string{"256.0.0.1"}, ec);
VERIFY( ec == std::errc::invalid_argument ); VERIFY( ec == std::errc::invalid_argument );
ip::make_address_v4(std::string{"127.0.0.1"}, ec); net::ip::make_address_v4(std::string{"127.0.0.1"}, ec);
VERIFY( !ec ); VERIFY( !ec );
a4 = ip::make_address_v4(std::experimental::string_view{""}, ec); a4 = net::ip::make_address_v4(std::experimental::string_view{""}, ec);
VERIFY( ec == std::errc::invalid_argument ); VERIFY( ec == std::errc::invalid_argument );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment