Navin P | 318e1df | 2021-03-21 19:15:46 +0530 | [diff] [blame] | 1 | #include <doctest/doctest.h> |
| 2 | |
| 3 | DOCTEST_MAKE_STD_HEADERS_CLEAN_FROM_WARNINGS_ON_WALL_BEGIN |
| 4 | #include <cstdint> |
| 5 | #include <sstream> |
| 6 | DOCTEST_MAKE_STD_HEADERS_CLEAN_FROM_WARNINGS_ON_WALL_END |
| 7 | |
| 8 | namespace user6 { |
| 9 | struct label |
| 10 | { |
| 11 | label() |
| 12 | : i(0) {} |
| 13 | int i; |
| 14 | friend bool operator==(const user6::label& lhs, const user6::label& rhs) { |
| 15 | return lhs.i == rhs.i; |
| 16 | } |
| 17 | }; |
| 18 | } // namespace user6 |
| 19 | |
| 20 | namespace user8 { |
| 21 | struct label |
| 22 | { |
| 23 | label() |
| 24 | : i(0) {} |
| 25 | int i; |
| 26 | }; |
| 27 | } // namespace user8 |
| 28 | |
| 29 | |
| 30 | DOCTEST_GCC_SUPPRESS_WARNING("-Wmissing-declarations") |
| 31 | DOCTEST_CLANG_SUPPRESS_WARNING("-Wmissing-prototypes") |
| 32 | |
| 33 | bool operator==(const user8::label& lhs, const user8::label& rhs) { return lhs.i == rhs.i; } |
| 34 | |
| 35 | |
| 36 | TEST_CASE("namespace 8 friend vs global") { |
| 37 | user6::label a6; |
| 38 | user6::label b6; |
| 39 | |
| 40 | user8::label a8; |
| 41 | user8::label b8; |
| 42 | |
| 43 | REQUIRE(a6 == b6); |
| 44 | REQUIRE(a8 == b8); |
| 45 | } |