]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/std/numerics/complex.number/cmplx.over/UDT_is_rejected.fail.cpp
Vendor import of libc++ trunk r290819:
[FreeBSD/FreeBSD.git] / test / std / numerics / complex.number / cmplx.over / UDT_is_rejected.fail.cpp
1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 // <complex>
11
12 // Test that UDT's convertible to an integral or floating point type do not
13 // participate in overload resolution.
14
15 #include <complex>
16 #include <type_traits>
17 #include <cassert>
18
19 template <class IntT>
20 struct UDT {
21   operator IntT() const { return 1; }
22 };
23
24 UDT<float> ft;
25 UDT<double> dt;
26 UDT<long double> ldt;
27 UDT<int> it;
28 UDT<unsigned long> uit;
29
30 int main()
31 {
32     {
33         std::real(ft); // expected-error {{no matching function}}
34         std::real(dt); // expected-error {{no matching function}}
35         std::real(ldt); // expected-error {{no matching function}}
36         std::real(it); // expected-error {{no matching function}}
37         std::real(uit); // expected-error {{no matching function}}
38     }
39     {
40         std::imag(ft); // expected-error {{no matching function}}
41         std::imag(dt); // expected-error {{no matching function}}
42         std::imag(ldt); // expected-error {{no matching function}}
43         std::imag(it); // expected-error {{no matching function}}
44         std::imag(uit); // expected-error {{no matching function}}
45     }
46     {
47         std::arg(ft); // expected-error {{no matching function}}
48         std::arg(dt); // expected-error {{no matching function}}
49         std::arg(ldt); // expected-error {{no matching function}}
50         std::arg(it); // expected-error {{no matching function}}
51         std::arg(uit); // expected-error {{no matching function}}
52     }
53     {
54         std::norm(ft); // expected-error {{no matching function}}
55         std::norm(dt); // expected-error {{no matching function}}
56         std::norm(ldt); // expected-error {{no matching function}}
57         std::norm(it); // expected-error {{no matching function}}
58         std::norm(uit); // expected-error {{no matching function}}
59     }
60     {
61         std::conj(ft); // expected-error {{no matching function}}
62         std::conj(dt); // expected-error {{no matching function}}
63         std::conj(ldt); // expected-error {{no matching function}}
64         std::conj(it); // expected-error {{no matching function}}
65         std::conj(uit); // expected-error {{no matching function}}
66     }
67     {
68         std::proj(ft); // expected-error {{no matching function}}
69         std::proj(dt); // expected-error {{no matching function}}
70         std::proj(ldt); // expected-error {{no matching function}}
71         std::proj(it); // expected-error {{no matching function}}
72         std::proj(uit); // expected-error {{no matching function}}
73     }
74 }