]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR78134 fix return types of heterogeneous lookup functions
authorJonathan Wakely <jwakely@redhat.com>
Tue, 14 Feb 2017 21:17:18 +0000 (21:17 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Tue, 14 Feb 2017 21:17:18 +0000 (21:17 +0000)
Backport from mainline
2017-01-11  Jonathan Wakely  <jwakely@redhat.com>

PR libstdc++/78134
* include/bits/stl_map.h (map::lower_bound, map::upper_bound)
(map::equal_range): Fix return type of heterogeneous overloads.
* include/bits/stl_multimap.h (multimap::lower_bound)
(multimap::upper_bound, multimap::equal_range): Likewise.
* include/bits/stl_multiset.h (multiset::lower_bound)
(multiset::upper_bound, multiset::equal_range): Likewise.
* include/bits/stl_set.h (set::lower_bound, set::upper_bound)
(set::equal_range): Likewise.
* testsuite/23_containers/map/operations/2.cc: Check return types.
* testsuite/23_containers/multimap/operations/2.cc: Likewise.
* testsuite/23_containers/multiset/operations/2.cc: Likewise.
* testsuite/23_containers/set/operations/2.cc: Likewise.

From-SVN: r245455

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/stl_map.h
libstdc++-v3/include/bits/stl_multimap.h
libstdc++-v3/include/bits/stl_multiset.h
libstdc++-v3/include/bits/stl_set.h
libstdc++-v3/testsuite/23_containers/map/operations/2.cc
libstdc++-v3/testsuite/23_containers/multimap/operations/2.cc
libstdc++-v3/testsuite/23_containers/multiset/operations/2.cc
libstdc++-v3/testsuite/23_containers/set/operations/2.cc

index 76d2dfcd1faf7d4f36e2cfcf336ab8450de7e16f..8bccfc8f9cdc0232dce95c17115a273341eded92 100644 (file)
@@ -3,6 +3,23 @@
        Backport from mainline
        2017-01-11  Jonathan Wakely  <jwakely@redhat.com>
 
+       PR libstdc++/78134
+       * include/bits/stl_map.h (map::lower_bound, map::upper_bound)
+       (map::equal_range): Fix return type of heterogeneous overloads.
+       * include/bits/stl_multimap.h (multimap::lower_bound)
+       (multimap::upper_bound, multimap::equal_range): Likewise.
+       * include/bits/stl_multiset.h (multiset::lower_bound)
+       (multiset::upper_bound, multiset::equal_range): Likewise.
+       * include/bits/stl_set.h (set::lower_bound, set::upper_bound)
+       (set::equal_range): Likewise.
+       * testsuite/23_containers/map/operations/2.cc: Check return types.
+       * testsuite/23_containers/multimap/operations/2.cc: Likewise.
+       * testsuite/23_containers/multiset/operations/2.cc: Likewise.
+       * testsuite/23_containers/set/operations/2.cc: Likewise.
+
+       Backport from mainline
+       2017-01-11  Jonathan Wakely  <jwakely@redhat.com>
+
        PR libstdc++/78273
        * include/bits/stl_map.h (map::count<_Kt>(const _Kt&)): Don't assume
        the heterogeneous comparison can only find one match.
index 89ba1d7a2ff8fa3e32ce07816a5777e592f699aa..1402607a13e7746c828ecdfb116302f58a599f36 100644 (file)
@@ -920,8 +920,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       template<typename _Kt>
        auto
        lower_bound(const _Kt& __x)
-       -> decltype(_M_t._M_lower_bound_tr(__x))
-       { return _M_t._M_lower_bound_tr(__x); }
+       -> decltype(iterator(_M_t._M_lower_bound_tr(__x)))
+       { return iterator(_M_t._M_lower_bound_tr(__x)); }
 #endif
       //@}
 
@@ -945,8 +945,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       template<typename _Kt>
        auto
        lower_bound(const _Kt& __x) const
-       -> decltype(_M_t._M_lower_bound_tr(__x))
-       { return _M_t._M_lower_bound_tr(__x); }
+       -> decltype(const_iterator(_M_t._M_lower_bound_tr(__x)))
+       { return const_iterator(_M_t._M_lower_bound_tr(__x)); }
 #endif
       //@}
 
@@ -965,8 +965,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       template<typename _Kt>
        auto
        upper_bound(const _Kt& __x)
-       -> decltype(_M_t._M_upper_bound_tr(__x))
-       { return _M_t._M_upper_bound_tr(__x); }
+       -> decltype(iterator(_M_t._M_upper_bound_tr(__x)))
+       { return iterator(_M_t._M_upper_bound_tr(__x)); }
 #endif
       //@}
 
@@ -985,8 +985,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       template<typename _Kt>
        auto
        upper_bound(const _Kt& __x) const
-       -> decltype(_M_t._M_upper_bound_tr(__x))
-       { return _M_t._M_upper_bound_tr(__x); }
+       -> decltype(const_iterator(_M_t._M_upper_bound_tr(__x)))
+       { return const_iterator(_M_t._M_upper_bound_tr(__x)); }
 #endif
       //@}
 
@@ -1014,8 +1014,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       template<typename _Kt>
        auto
        equal_range(const _Kt& __x)
-       -> decltype(_M_t._M_equal_range_tr(__x))
-       { return _M_t._M_equal_range_tr(__x); }
+       -> decltype(pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)))
+       { return pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)); }
 #endif
       //@}
 
@@ -1043,8 +1043,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       template<typename _Kt>
        auto
        equal_range(const _Kt& __x) const
-       -> decltype(_M_t._M_equal_range_tr(__x))
-       { return _M_t._M_equal_range_tr(__x); }
+       -> decltype(pair<const_iterator, const_iterator>(
+             _M_t._M_equal_range_tr(__x)))
+       {
+         return pair<const_iterator, const_iterator>(
+             _M_t._M_equal_range_tr(__x));
+       }
 #endif
       //@}
 
index 20076a1fd0439b349374c3c3c6c275462df36e3a..c6fd14262d8cfc5fec7c33b4749ad5e7affb2555 100644 (file)
@@ -825,8 +825,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       template<typename _Kt>
        auto
        lower_bound(const _Kt& __x)
-       -> decltype(_M_t._M_lower_bound_tr(__x))
-       { return _M_t._M_lower_bound_tr(__x); }
+       -> decltype(iterator(_M_t._M_lower_bound_tr(__x)))
+       { return iterator(_M_t._M_lower_bound_tr(__x)); }
 #endif
       //@}
 
@@ -850,8 +850,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       template<typename _Kt>
        auto
        lower_bound(const _Kt& __x) const
-       -> decltype(_M_t._M_lower_bound_tr(__x))
-       { return _M_t._M_lower_bound_tr(__x); }
+       -> decltype(const_iterator(_M_t._M_lower_bound_tr(__x)))
+       { return const_iterator(_M_t._M_lower_bound_tr(__x)); }
 #endif
       //@}
 
@@ -870,8 +870,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       template<typename _Kt>
        auto
        upper_bound(const _Kt& __x)
-       -> decltype(_M_t._M_upper_bound_tr(__x))
-       { return _M_t._M_upper_bound_tr(__x); }
+       -> decltype(iterator(_M_t._M_upper_bound_tr(__x)))
+       { return iterator(_M_t._M_upper_bound_tr(__x)); }
 #endif
       //@}
 
@@ -890,8 +890,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       template<typename _Kt>
        auto
        upper_bound(const _Kt& __x) const
-       -> decltype(_M_t._M_upper_bound_tr(__x))
-       { return _M_t._M_upper_bound_tr(__x); }
+       -> decltype(const_iterator(_M_t._M_upper_bound_tr(__x)))
+       { return const_iterator(_M_t._M_upper_bound_tr(__x)); }
 #endif
       //@}
 
@@ -917,8 +917,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       template<typename _Kt>
        auto
        equal_range(const _Kt& __x)
-       -> decltype(_M_t._M_equal_range_tr(__x))
-       { return _M_t._M_equal_range_tr(__x); }
+       -> decltype(pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)))
+       { return pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)); }
 #endif
       //@}
 
@@ -944,8 +944,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       template<typename _Kt>
        auto
        equal_range(const _Kt& __x) const
-       -> decltype(_M_t._M_equal_range_tr(__x))
-       { return _M_t._M_equal_range_tr(__x); }
+       -> decltype(pair<const_iterator, const_iterator>(
+             _M_t._M_equal_range_tr(__x)))
+       {
+         return pair<const_iterator, const_iterator>(
+             _M_t._M_equal_range_tr(__x));
+       }
 #endif
       //@}
 
index 3a947d53fba49d7f2301027653a39d9bb25ca4fb..28d80f0cbc443b4ba5d67ae0278908805f020ed0 100644 (file)
@@ -719,14 +719,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       template<typename _Kt>
        auto
        lower_bound(const _Kt& __x)
-       -> decltype(_M_t._M_lower_bound_tr(__x))
-       { return _M_t._M_lower_bound_tr(__x); }
+       -> decltype(iterator(_M_t._M_lower_bound_tr(__x)))
+       { return iterator(_M_t._M_lower_bound_tr(__x)); }
 
       template<typename _Kt>
        auto
        lower_bound(const _Kt& __x) const
-       -> decltype(_M_t._M_lower_bound_tr(__x))
-       { return _M_t._M_lower_bound_tr(__x); }
+       -> decltype(iterator(_M_t._M_lower_bound_tr(__x)))
+       { return iterator(_M_t._M_lower_bound_tr(__x)); }
 #endif
       //@}
 
@@ -749,14 +749,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       template<typename _Kt>
        auto
        upper_bound(const _Kt& __x)
-       -> decltype(_M_t._M_upper_bound_tr(__x))
-       { return _M_t._M_upper_bound_tr(__x); }
+       -> decltype(iterator(_M_t._M_upper_bound_tr(__x)))
+       { return iterator(_M_t._M_upper_bound_tr(__x)); }
 
       template<typename _Kt>
        auto
        upper_bound(const _Kt& __x) const
-       -> decltype(_M_t._M_upper_bound_tr(__x))
-       { return _M_t._M_upper_bound_tr(__x); }
+       -> decltype(iterator(_M_t._M_upper_bound_tr(__x)))
+       { return iterator(_M_t._M_upper_bound_tr(__x)); }
 #endif
       //@}
 
@@ -788,14 +788,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       template<typename _Kt>
        auto
        equal_range(const _Kt& __x)
-       -> decltype(_M_t._M_equal_range_tr(__x))
-       { return _M_t._M_equal_range_tr(__x); }
+       -> decltype(pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)))
+       { return pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)); }
 
       template<typename _Kt>
        auto
        equal_range(const _Kt& __x) const
-       -> decltype(_M_t._M_equal_range_tr(__x))
-       { return _M_t._M_equal_range_tr(__x); }
+       -> decltype(pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)))
+       { return pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)); }
 #endif
       //@}
 
index 7c1c1c60a83b13d7f5d4ce37742ba36c89de346a..c4cd597fca2cd19fd7190c42683f283d9be368e8 100644 (file)
@@ -738,14 +738,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       template<typename _Kt>
        auto
        lower_bound(const _Kt& __x)
-       -> decltype(_M_t._M_lower_bound_tr(__x))
-       { return _M_t._M_lower_bound_tr(__x); }
+       -> decltype(iterator(_M_t._M_lower_bound_tr(__x)))
+       { return iterator(_M_t._M_lower_bound_tr(__x)); }
 
       template<typename _Kt>
        auto
        lower_bound(const _Kt& __x) const
-       -> decltype(_M_t._M_lower_bound_tr(__x))
-       { return _M_t._M_lower_bound_tr(__x); }
+       -> decltype(const_iterator(_M_t._M_lower_bound_tr(__x)))
+       { return const_iterator(_M_t._M_lower_bound_tr(__x)); }
 #endif
       //@}
 
@@ -768,14 +768,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       template<typename _Kt>
        auto
        upper_bound(const _Kt& __x)
-       -> decltype(_M_t._M_upper_bound_tr(__x))
-       { return _M_t._M_upper_bound_tr(__x); }
+       -> decltype(iterator(_M_t._M_upper_bound_tr(__x)))
+       { return iterator(_M_t._M_upper_bound_tr(__x)); }
 
       template<typename _Kt>
        auto
        upper_bound(const _Kt& __x) const
-       -> decltype(_M_t._M_upper_bound_tr(__x))
-       { return _M_t._M_upper_bound_tr(__x); }
+       -> decltype(iterator(_M_t._M_upper_bound_tr(__x)))
+       { return const_iterator(_M_t._M_upper_bound_tr(__x)); }
 #endif
       //@}
 
@@ -807,14 +807,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       template<typename _Kt>
        auto
        equal_range(const _Kt& __x)
-       -> decltype(_M_t._M_equal_range_tr(__x))
-       { return _M_t._M_equal_range_tr(__x); }
+       -> decltype(pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)))
+       { return pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)); }
 
       template<typename _Kt>
        auto
        equal_range(const _Kt& __x) const
-       -> decltype(_M_t._M_equal_range_tr(__x))
-       { return _M_t._M_equal_range_tr(__x); }
+       -> decltype(pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)))
+       { return pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)); }
 #endif
       //@}
 
index cbfd223226608c10cf7213383e2c2636d842d2e9..0613aa2105aee112e308fc7dece0c42990d08f43 100644 (file)
@@ -53,7 +53,7 @@ test01()
   cit = cx.find(2L);
   VERIFY( cit == cx.end() );
 
-  VERIFY( Cmp::count == 0);
+  VERIFY( Cmp::count == 0 );
 
   static_assert(std::is_same<decltype(it), test_type::iterator>::value,
       "find returns iterator");
@@ -76,7 +76,7 @@ test02()
   cn = cx.count(2L);
   VERIFY( cn == 0 );
 
-  VERIFY( Cmp::count == 0);
+  VERIFY( Cmp::count == 0 );
 }
 
 void
@@ -94,7 +94,12 @@ test03()
   cit = cx.lower_bound(2L);
   VERIFY( cit != cx.end() && cit->second == '4' );
 
-  VERIFY( Cmp::count == 0);
+  VERIFY( Cmp::count == 0 );
+
+  static_assert(std::is_same<decltype(it), test_type::iterator>::value,
+      "lower_bound returns iterator");
+  static_assert(std::is_same<decltype(cit), test_type::const_iterator>::value,
+      "const lower_bound returns const_iterator");
 }
 
 void
@@ -112,7 +117,12 @@ test04()
   cit = cx.upper_bound(3L);
   VERIFY( cit == cx.end() );
 
-  VERIFY( Cmp::count == 0);
+  VERIFY( Cmp::count == 0 );
+
+  static_assert(std::is_same<decltype(it), test_type::iterator>::value,
+      "upper_bound returns iterator");
+  static_assert(std::is_same<decltype(cit), test_type::const_iterator>::value,
+      "const upper_bound returns const_iterator");
 }
 
 void
@@ -130,7 +140,14 @@ test05()
   cit = cx.equal_range(2L);
   VERIFY( cit.first == cit.second && cit.first != cx.end() );
 
-  VERIFY( Cmp::count == 0);
+  VERIFY( Cmp::count == 0 );
+
+  using pair = std::pair<test_type::iterator, test_type::iterator>;
+  static_assert(std::is_same<decltype(it), pair>::value,
+      "equal_range returns pair<iterator, iterator>");
+  using cpair = std::pair<test_type::const_iterator, test_type::const_iterator>;
+  static_assert(std::is_same<decltype(cit), cpair>::value,
+      "const equal_range returns pair<const_iterator, const_iterator>");
 }
 
 void
index eef6ee4515d706e3ed47305d73660e12132944e0..99099c39e2c882057a1d002ee61742ecdb753202 100644 (file)
@@ -53,7 +53,7 @@ test01()
   cit = cx.find(2L);
   VERIFY( cit == cx.end() );
 
-  VERIFY( Cmp::count == 0);
+  VERIFY( Cmp::count == 0 );
 
   static_assert(std::is_same<decltype(it), test_type::iterator>::value,
       "find returns iterator");
@@ -76,7 +76,7 @@ test02()
   cn = cx.count(2L);
   VERIFY( cn == 0 );
 
-  VERIFY( Cmp::count == 0);
+  VERIFY( Cmp::count == 0 );
 }
 
 void
@@ -94,7 +94,12 @@ test03()
   cit = cx.lower_bound(2L);
   VERIFY( cit != cx.end() && cit->second == '4' );
 
-  VERIFY( Cmp::count == 0);
+  VERIFY( Cmp::count == 0 );
+
+  static_assert(std::is_same<decltype(it), test_type::iterator>::value,
+      "lower_bound returns iterator");
+  static_assert(std::is_same<decltype(cit), test_type::const_iterator>::value,
+      "const lower_bound returns const_iterator");
 }
 
 void
@@ -112,7 +117,12 @@ test04()
   cit = cx.upper_bound(3L);
   VERIFY( cit == cx.end() );
 
-  VERIFY( Cmp::count == 0);
+  VERIFY( Cmp::count == 0 );
+
+  static_assert(std::is_same<decltype(it), test_type::iterator>::value,
+      "upper_bound returns iterator");
+  static_assert(std::is_same<decltype(cit), test_type::const_iterator>::value,
+      "const upper_bound returns const_iterator");
 }
 
 void
@@ -131,7 +141,14 @@ test05()
   cit = cx.equal_range(2L);
   VERIFY( cit.first == cit.second && cit.first != cx.end() );
 
-  VERIFY( Cmp::count == 0);
+  VERIFY( Cmp::count == 0 );
+
+  using pair = std::pair<test_type::iterator, test_type::iterator>;
+  static_assert(std::is_same<decltype(it), pair>::value,
+      "equal_range returns pair<iterator, iterator>");
+  using cpair = std::pair<test_type::const_iterator, test_type::const_iterator>;
+  static_assert(std::is_same<decltype(cit), cpair>::value,
+      "const equal_range returns pair<const_iterator, const_iterator>");
 }
 
 
index 4bea719160f4315cd1eca6f20a19aef7232d0771..3123169d0353955f9726ae24b07b45f38418168b 100644 (file)
@@ -53,7 +53,7 @@ test01()
   cit = cx.find(2L);
   VERIFY( cit == cx.end() );
 
-  VERIFY( Cmp::count == 0);
+  VERIFY( Cmp::count == 0 );
 
   static_assert(std::is_same<decltype(it), test_type::iterator>::value,
       "find returns iterator");
@@ -76,7 +76,7 @@ test02()
   cn = cx.count(2L);
   VERIFY( cn == 0 );
 
-  VERIFY( Cmp::count == 0);
+  VERIFY( Cmp::count == 0 );
 }
 
 void
@@ -94,7 +94,12 @@ test03()
   cit = cx.lower_bound(2L);
   VERIFY( cit != cx.end() && *cit == 3 );
 
-  VERIFY( Cmp::count == 0);
+  VERIFY( Cmp::count == 0 );
+
+  static_assert(std::is_same<decltype(it), test_type::iterator>::value,
+      "lower_bound returns iterator");
+  static_assert(std::is_same<decltype(cit), test_type::const_iterator>::value,
+      "const lower_bound returns const_iterator");
 }
 
 void
@@ -112,7 +117,12 @@ test04()
   cit = cx.upper_bound(5L);
   VERIFY( cit == cx.end() );
 
-  VERIFY( Cmp::count == 0);
+  VERIFY( Cmp::count == 0 );
+
+  static_assert(std::is_same<decltype(it), test_type::iterator>::value,
+      "upper_bound returns iterator");
+  static_assert(std::is_same<decltype(cit), test_type::const_iterator>::value,
+      "const upper_bound returns const_iterator");
 }
 
 void
@@ -131,7 +141,14 @@ test05()
   cit = cx.equal_range(2L);
   VERIFY( cit.first == cit.second && cit.first != cx.end() );
 
-  VERIFY( Cmp::count == 0);
+  VERIFY( Cmp::count == 0 );
+
+  using pair = std::pair<test_type::iterator, test_type::iterator>;
+  static_assert(std::is_same<decltype(it), pair>::value,
+      "equal_range returns pair<iterator, iterator>");
+  using cpair = std::pair<test_type::const_iterator, test_type::const_iterator>;
+  static_assert(std::is_same<decltype(cit), cpair>::value,
+      "const equal_range returns pair<const_iterator, const_iterator>");
 }
 
 
index 30355d4afafa9d5508fc14e6c48d00461b6dbaeb..507aa955b29c5f8cebed54983339418cbfe92d6e 100644 (file)
@@ -53,7 +53,7 @@ test01()
   cit = cx.find(2L);
   VERIFY( cit == cx.end() );
 
-  VERIFY( Cmp::count == 0);
+  VERIFY( Cmp::count == 0 );
 
   static_assert(std::is_same<decltype(it), test_type::iterator>::value,
       "find returns iterator");
@@ -76,7 +76,7 @@ test02()
   cn = cx.count(2L);
   VERIFY( cn == 0 );
 
-  VERIFY( Cmp::count == 0);
+  VERIFY( Cmp::count == 0 );
 }
 
 void
@@ -94,7 +94,12 @@ test03()
   cit = cx.lower_bound(2L);
   VERIFY( cit != cx.end() && *cit == 3 );
 
-  VERIFY( Cmp::count == 0);
+  VERIFY( Cmp::count == 0 );
+
+  static_assert(std::is_same<decltype(it), test_type::iterator>::value,
+      "lower_bound returns iterator");
+  static_assert(std::is_same<decltype(cit), test_type::const_iterator>::value,
+      "const lower_bound returns const_iterator");
 }
 
 void
@@ -112,7 +117,12 @@ test04()
   cit = cx.upper_bound(5L);
   VERIFY( cit == cx.end() );
 
-  VERIFY( Cmp::count == 0);
+  VERIFY( Cmp::count == 0 );
+
+  static_assert(std::is_same<decltype(it), test_type::iterator>::value,
+      "upper_bound returns iterator");
+  static_assert(std::is_same<decltype(cit), test_type::const_iterator>::value,
+      "const upper_bound returns const_iterator");
 }
 
 void
@@ -130,7 +140,14 @@ test05()
   cit = cx.equal_range(2L);
   VERIFY( cit.first == cit.second && cit.first != cx.end() );
 
-  VERIFY( Cmp::count == 0);
+  VERIFY( Cmp::count == 0 );
+
+  using pair = std::pair<test_type::iterator, test_type::iterator>;
+  static_assert(std::is_same<decltype(it), pair>::value,
+      "equal_range returns pair<iterator, iterator>");
+  using cpair = std::pair<test_type::const_iterator, test_type::const_iterator>;
+  static_assert(std::is_same<decltype(cit), cpair>::value,
+      "const equal_range returns pair<const_iterator, const_iterator>");
 }
 
 void