From Jason Turner

[over.ics.rank]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpizzcvonz/{from.md → to.md} +23 -1
tmp/tmpizzcvonz/{from.md → to.md} RENAMED
@@ -181,19 +181,41 @@ indistinguishable unless one of the following rules applies:
181
  - A conversion that does not convert a pointer or a pointer to member to
182
  `bool` is better than one that does.
183
  - A conversion that promotes an enumeration whose underlying type is
184
  fixed to its underlying type is better than one that promotes to the
185
  promoted underlying type, if the two are different.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
  - If class `B` is derived directly or indirectly from class `A`,
187
  conversion of `B*` to `A*` is better than conversion of `B*` to
188
  `void*`, and conversion of `A*` to `void*` is better than conversion
189
  of `B*` to `void*`.
190
  - If class `B` is derived directly or indirectly from class `A` and
191
  class `C` is derived directly or indirectly from `B`,
192
  - conversion of `C*` to `B*` is better than conversion of `C*` to
193
  `A*`,
194
- \[*Example 8*:
195
  ``` cpp
196
  struct A {};
197
  struct B : public A {};
198
  struct C : public B {};
199
  C* pc;
 
181
  - A conversion that does not convert a pointer or a pointer to member to
182
  `bool` is better than one that does.
183
  - A conversion that promotes an enumeration whose underlying type is
184
  fixed to its underlying type is better than one that promotes to the
185
  promoted underlying type, if the two are different.
186
+ - A conversion in either direction between floating-point type `FP1` and
187
+ floating-point type `FP2` is better than a conversion in the same
188
+ direction between `FP1` and arithmetic type `T3` if
189
+ - the floating-point conversion rank [[conv.rank]] of `FP1` is equal
190
+ to the rank of `FP2`, and
191
+ - `T3` is not a floating-point type, or `T3` is a floating-point type
192
+ whose rank is not equal to the rank of `FP1`, or the floating-point
193
+ conversion subrank [[conv.rank]] of `FP2` is greater than the
194
+ subrank of `T3`.
195
+ \[*Example 8*:
196
+ ``` cpp
197
+ int f(std::float32_t);
198
+ int f(std::float64_t);
199
+ int f(long long);
200
+ float x;
201
+ std::float16_t y;
202
+ int i = f(x); // calls f(std::float32_t) on implementations where
203
+ // float and std::float32_t have equal conversion ranks
204
+ int j = f(y); // error: ambiguous, no equal conversion rank
205
+ ```
206
+
207
+ — *end example*]
208
  - If class `B` is derived directly or indirectly from class `A`,
209
  conversion of `B*` to `A*` is better than conversion of `B*` to
210
  `void*`, and conversion of `A*` to `void*` is better than conversion
211
  of `B*` to `void*`.
212
  - If class `B` is derived directly or indirectly from class `A` and
213
  class `C` is derived directly or indirectly from `B`,
214
  - conversion of `C*` to `B*` is better than conversion of `C*` to
215
  `A*`,
216
+ \[*Example 9*:
217
  ``` cpp
218
  struct A {};
219
  struct B : public A {};
220
  struct C : public B {};
221
  C* pc;