libstdc++-v3/testsuite/20_util/tuple/comparison_operators/119545.cc
raw| 1 | // { dg-do compile { target c++11 } } |
| 2 | // Bug libstdc++/119545 |
| 3 | // tuple::operator==()'s help lambda does not specify return type as bool |
| 4 | |
| 5 | #include <tuple> |
| 6 | |
| 7 | void |
| 8 | test_pr119545() |
| 9 | { |
| 10 | struct Bool { |
| 11 | Bool() = default; |
| 12 | Bool(const Bool&) = delete; |
| 13 | operator bool() const { return true; } |
| 14 | }; |
| 15 | |
| 16 | static Bool b; |
| 17 | |
| 18 | struct Object { |
| 19 | const Bool& operator==(const Object&) const { return b; } |
| 20 | }; |
| 21 | |
| 22 | std::tuple<Object> t; |
| 23 | (void) (t == t); |
| 24 | } |