Debian Codegraph @

libstdc++-v3/testsuite/19_diagnostics/error_condition/cons/lwg3629.cc

raw
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_condition 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_condition(User::E1);
13
14 #include <future> // declares std::make_error_condition(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_condition_enum<User::E1> : std::true_type { };
36 template<> struct std::is_error_condition_enum<User::E2> : std::true_type { };
37 template<> struct std::is_error_condition_enum<User::E3> : std::true_type { };
38
39 // ::make_error_condition(E1) should not be found by name lookup.
40 std::error_condition e1( User::E1{} ); // { dg-error "here" }
41
42 // std::make_error_condition(future_errc) should not be found by name lookup.
43 std::error_condition e2( User::E2{} ); // { dg-error "here" }
44
45 // std::make_error_condition(errc) should not be found by name lookup.
46 std::error_condition e3( User::E3{} ); // { dg-error "here" }
47
48 // { dg-error "use of deleted function" "" { target *-*-* } 0 }