| 1 | // { dg-do compile { target c++11 } } |
| 2 | |
| 3 | // 3629. make_error_code and make_error_condition are customization points |
| 4 | // Verify that make_error_code is looked up using ADL only. |
| 5 | |
| 6 | namespace User |
| 7 | { |
| 8 | struct E1; |
| 9 | } |
| 10 | |
| 11 | // N.B. not in associated namespace of E1, and declared before <system_error>. |
| 12 | User::E1 make_error_code(User::E1); |
| 13 | |
| 14 | #include <future> // declares std::make_error_code(future_errc) |
| 15 | #include <system_error> |
| 16 | |
| 17 | namespace User |
| 18 | { |
| 19 | struct E1 |
| 20 | { |
| 21 | operator std::error_code() const; |
| 22 | }; |
| 23 | |
| 24 | struct E2 |
| 25 | { |
| 26 | operator std::future_errc() const; |
| 27 | }; |
| 28 | |
| 29 | struct E3 |
| 30 | { |
| 31 | operator std::errc() const; |
| 32 | }; |
| 33 | } |
| 34 | |
| 35 | template<> struct std::is_error_code_enum<User::E1> : std::true_type { }; |
| 36 | template<> struct std::is_error_code_enum<User::E2> : std::true_type { }; |
| 37 | template<> struct std::is_error_code_enum<User::E3> : std::true_type { }; |
| 38 | |
| 39 | // ::make_error_code(E1) should not be found by name lookup. |
| 40 | std::error_code e1( User::E1{} ); // { dg-error "here" } |
| 41 | |
| 42 | // std::make_error_code(future_errc) should not be found by name lookup. |
| 43 | std::error_code e2( User::E2{} ); // { dg-error "here" } |
| 44 | |
| 45 | // std::make_error_code(errc) should not be found by name lookup. |
| 46 | std::error_code e3( User::E3{} ); // { dg-error "here" } |
| 47 | |
| 48 | // { dg-error "use of deleted function" "" { target *-*-* } 0 } |