From 436ea0e5d316be9867bb23db70a09e12107c0d7d Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Tue, 16 Oct 2018 17:13:00 +0100 Subject: [PATCH] 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 . From-SVN: r265205 --- libstdc++-v3/ChangeLog | 4 ++++ .../net/internet/address/v4/creation.cc | 24 +++++++++---------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index d20f497148f..bfc9f73213c 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,9 @@ 2018-10-16 Jonathan Wakely + * testsuite/experimental/net/internet/address/v4/creation.cc: Do not + declare ip in global namespace, to avoid collision with struct ip + defined in . + * include/experimental/bits/net.h: Move versioned namespace macros to correct location. * include/experimental/buffer: Likewise. diff --git a/libstdc++-v3/testsuite/experimental/net/internet/address/v4/creation.cc b/libstdc++-v3/testsuite/experimental/net/internet/address/v4/creation.cc index bf92b213fc8..770918f4686 100644 --- a/libstdc++-v3/testsuite/experimental/net/internet/address/v4/creation.cc +++ b/libstdc++-v3/testsuite/experimental/net/internet/address/v4/creation.cc @@ -21,8 +21,8 @@ #include #include -namespace ip = std::experimental::net::ip; -using ip::address_v4; +namespace net = std::experimental::net; +using net::ip::address_v4; void test01() @@ -44,12 +44,12 @@ test02() { 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_bytes() == address_v4::bytes_type{} ); 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_bytes() == address_v4::bytes_type( 5, 6, 7, 8 ) ); } @@ -59,27 +59,27 @@ test03() { 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() ); - 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() ); - 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() ); 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 ); - ip::make_address_v4("127.0.0.1", ec); + net::ip::make_address_v4("127.0.0.1", 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 ); - 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 ); - 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 ); }