[flang][runtime] Make defined formatted I/O process format elementally (#74150)
[llvm-project.git] / libcxx / test / support / propagate_const_helpers.h
bloba9df1b99ed2b889ee9430187d0504a9f1c808e88
1 // A lightweight class, with pointer-like methods, that contains an int
2 struct X
4 int i_;
6 constexpr const int &operator*() const { return i_; }
7 constexpr int &operator*() { return i_; }
8 constexpr const int *get() const { return &i_; }
9 constexpr int *get() { return &i_; }
10 constexpr const int *operator->() const { return &i_; }
11 constexpr int *operator->() { return &i_; }
13 constexpr X(int i) : i_(i) {}
16 struct XWithImplicitIntStarConversion
18 int i_;
20 constexpr const int &operator*() const { return i_; }
21 constexpr int &operator*() { return i_; }
22 constexpr const int *get() const { return &i_; }
23 constexpr int *get() { return &i_; }
24 constexpr const int *operator->() const { return &i_; }
25 constexpr int *operator->() { return &i_; }
26 constexpr operator int* () { return &i_; }
28 constexpr XWithImplicitIntStarConversion(int i) : i_(i) {}
31 struct XWithImplicitConstIntStarConversion
33 int i_;
35 constexpr const int &operator*() const { return i_; }
36 constexpr int &operator*() { return i_; }
37 constexpr const int *get() const { return &i_; }
38 constexpr int *get() { return &i_; }
39 constexpr const int *operator->() const { return &i_; }
40 constexpr int *operator->() { return &i_; }
41 constexpr operator const int* () const { return &i_; }
43 constexpr XWithImplicitConstIntStarConversion(int i) : i_(i) {}
46 struct ExplicitX
48 int i_;
50 constexpr const int &operator*() const { return i_; }
51 constexpr int &operator*() { return i_; }
52 constexpr const int *get() const { return &i_; }
53 constexpr int *get() { return &i_; }
54 constexpr const int *operator->() const { return &i_; }
55 constexpr int *operator->() { return &i_; }
57 constexpr explicit ExplicitX(int i) : i_(i) {}
60 struct MoveConstructibleFromX
62 int i_;
64 constexpr const int &operator*() const { return i_; }
65 constexpr int &operator*() { return i_; }
66 constexpr const int *get() const { return &i_; }
67 constexpr int *get() { return &i_; }
68 constexpr const int *operator->() const { return &i_; }
69 constexpr int *operator->() { return &i_; }
71 constexpr MoveConstructibleFromX(int i) : i_(i) {}
72 constexpr MoveConstructibleFromX(X&& x) : i_(x.i_) {}
75 struct ExplicitMoveConstructibleFromX
77 int i_;
79 constexpr const int &operator*() const { return i_; }
80 constexpr int &operator*() { return i_; }
81 constexpr const int *get() const { return &i_; }
82 constexpr int *get() { return &i_; }
83 constexpr const int *operator->() const { return &i_; }
84 constexpr int *operator->() { return &i_; }
86 constexpr ExplicitMoveConstructibleFromX(int i) : i_(i) {}
87 constexpr explicit ExplicitMoveConstructibleFromX(X&& x) : i_(x.i_) {}
90 struct CopyConstructibleFromX
92 int i_;
94 constexpr const int &operator*() const { return i_; }
95 constexpr int &operator*() { return i_; }
96 constexpr const int *get() const { return &i_; }
97 constexpr int *get() { return &i_; }
98 constexpr const int *operator->() const { return &i_; }
99 constexpr int *operator->() { return &i_; }
101 constexpr CopyConstructibleFromX(int i) : i_(i) {}
102 constexpr CopyConstructibleFromX(const X& x) : i_(x.i_) {}
105 struct ExplicitCopyConstructibleFromX
107 int i_;
109 constexpr const int &operator*() const { return i_; }
110 constexpr int &operator*() { return i_; }
111 constexpr const int *get() const { return &i_; }
112 constexpr int *get() { return &i_; }
113 constexpr const int *operator->() const { return &i_; }
114 constexpr int *operator->() { return &i_; }
116 constexpr ExplicitCopyConstructibleFromX(int i) : i_(i) {}
117 constexpr explicit ExplicitCopyConstructibleFromX(const X& x) : i_(x.i_) {}