d: Merge dmd, druntime c7902293d7, phobos 03aeafd20
[gcc.git] / libstdc++-v3 / testsuite / 23_containers / unordered_map / 115939.cc
blob3a68acaff77f073007dd917a35f90f8ae91c1907
1 // { dg-options "-pedantic" }
2 // { dg-do compile { target c++11 } }
4 // Bug 115939 - Cannot unambiguously compare iterators in std::unordered_map
6 #include <unordered_map>
8 struct any_conv
10 template<typename T>
11 any_conv(T&&) { }
13 template<typename T>
14 friend bool operator==(const any_conv&, const T&) { return true; }
16 template<typename T>
17 friend bool operator!=(const any_conv&, const T&) { return false; }
20 std::unordered_map<int, any_conv>::iterator i{};
21 std::unordered_map<int, any_conv>::const_iterator j{};
22 bool b1 = i == i; // { dg-bogus "ambiguous" }
23 bool b2 = j == j; // { dg-bogus "ambiguous" }
24 bool b3 = i == j; // { dg-bogus "ambiguous" }
25 bool b4 = j == i; // { dg-bogus "ambiguous" }
26 bool b5 = i != i; // { dg-bogus "ambiguous" }
27 bool b6 = j != j; // { dg-bogus "ambiguous" }
28 bool b7 = i != j; // { dg-bogus "ambiguous" }
29 bool b8 = j != i; // { dg-bogus "ambiguous" }