From Jason Turner

[expr.type.conv]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp4bilh36_/{from.md → to.md} +24 -5
tmp/tmp4bilh36_/{from.md → to.md} RENAMED
@@ -5,16 +5,35 @@ A *simple-type-specifier* [[dcl.type.simple]] or *typename-specifier*
5
  by a *braced-init-list* (the initializer) constructs a value of the
6
  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
 
11
  If the initializer is a parenthesized single expression, the type
12
  conversion expression is equivalent to the corresponding cast expression
13
  [[expr.cast]]. Otherwise, if the type is cv `void` and the initializer
14
  is `()` or `{}` (after pack expansion, if any), the expression is a
15
- prvalue of the specified type that performs no initialization.
16
- Otherwise, the expression is a prvalue of the specified type whose
17
- result object is direct-initialized [[dcl.init]] with the initializer.
18
- If the initializer is a parenthesized optional *expression-list*, the
19
- specified type shall not be an array type.
20
 
 
5
  by a *braced-init-list* (the initializer) constructs a value of the
6
  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 {};
18
+ void f(A&); // #1
19
+ void f(A&&); // #2
20
+ A& g();
21
+ void h() {
22
+ f(g()); // calls #1
23
+ f(A(g())); // calls #2 with a temporary object
24
+ f(auto(g())); // calls #2 with a temporary object
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