From Jason Turner

[expr.type.conv]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpkk1kiqtf/{from.md → to.md} +18 -11
tmp/tmpkk1kiqtf/{from.md → to.md} RENAMED
@@ -7,11 +7,28 @@ specified type given the initializer. If the type is a placeholder for a
7
  deduced class type, it is replaced by the return type of the function
8
  selected by overload resolution for class template deduction
9
  [[over.match.class.deduct]] for the remainder of this subclause.
10
  Otherwise, if the type contains a placeholder type, it is replaced by
11
  the type determined by placeholder type deduction
12
- [[dcl.type.auto.deduct]].
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
  [*Example 1*:
15
 
16
  ``` cpp
17
  struct A {};
@@ -25,15 +42,5 @@ void h() {
25
  }
26
  ```
27
 
28
  — *end example*]
29
 
30
- If the initializer is a parenthesized single expression, the type
31
- conversion expression is equivalent to the corresponding cast expression
32
- [[expr.cast]]. Otherwise, if the type is cv `void` and the initializer
33
- is `()` or `{}` (after pack expansion, if any), the expression is a
34
- prvalue of type `void` that performs no initialization. Otherwise, the
35
- expression is a prvalue of the specified type whose result object is
36
- direct-initialized [[dcl.init]] with the initializer. If the initializer
37
- is a parenthesized optional *expression-list*, the specified type shall
38
- not be an array type.
39
-
 
7
  deduced class type, it is replaced by the return type of the function
8
  selected by overload resolution for class template deduction
9
  [[over.match.class.deduct]] for the remainder of this subclause.
10
  Otherwise, if the type contains a placeholder type, it is replaced by
11
  the type determined by placeholder type deduction
12
+ [[dcl.type.auto.deduct]]. Let `T` denote the resulting type. Then:
13
+
14
+ - If the initializer is a parenthesized single expression, the type
15
+ conversion expression is equivalent to the corresponding cast
16
+ expression [[expr.cast]].
17
+ - Otherwise, if `T` is cv `void`, the initializer shall be `()` or `{}`
18
+ (after pack expansion, if any), and the expression is a prvalue of
19
+ type `void` that performs no initialization.
20
+ - Otherwise, if `T` is a reference type, the expression has the same
21
+ effect as direct-initializing an invented variable `t` of type `T`
22
+ from the initializer and then using `t` as the result of the
23
+ expression; the result is an lvalue if `T` is an lvalue reference type
24
+ or an rvalue reference to function type and an xvalue otherwise.
25
+ - Otherwise, the expression is a prvalue of type `T` whose result object
26
+ is direct-initialized [[dcl.init]] with the initializer.
27
+
28
+ If the initializer is a parenthesized optional *expression-list*, `T`
29
+ shall not be an array type.
30
 
31
  [*Example 1*:
32
 
33
  ``` cpp
34
  struct A {};
 
42
  }
43
  ```
44
 
45
  — *end example*]
46