From Jason Turner

[dcl.type.decltype]

Diff to HTML by rtfpessoa

tmp/tmpw0c95057/{from.md → to.md} RENAMED
@@ -12,23 +12,23 @@ follows:
12
  [[dcl.struct.bind]], `decltype(E)` is the referenced type as given in
13
  the specification of the structured binding declaration;
14
  - otherwise, if E is an unparenthesized *id-expression* naming a
15
  non-type *template-parameter* [[temp.param]], `decltype(E)` is the
16
  type of the *template-parameter* after performing any necessary type
17
- deduction ([[dcl.spec.auto]], [[dcl.type.class.deduct]]);
18
  - otherwise, if E is an unparenthesized *id-expression* or an
19
  unparenthesized class member access [[expr.ref]], `decltype(E)` is the
20
- type of the entity named by E. If there is no such entity, or if E
21
- names a set of overloaded functions, the program is ill-formed;
22
  - otherwise, if E is an xvalue, `decltype(E)` is `T&&`, where `T` is the
23
  type of E;
24
  - otherwise, if E is an lvalue, `decltype(E)` is `T&`, where `T` is the
25
  type of E;
26
  - otherwise, `decltype(E)` is the type of E.
27
 
28
  The operand of the `decltype` specifier is an unevaluated operand
29
- [[expr.prop]].
30
 
31
  [*Example 1*:
32
 
33
  ``` cpp
34
  const int&& foo();
@@ -78,11 +78,11 @@ template<class T> auto f(T) // #1
78
  // for the temporary introduced by the use of h().
79
  // (A temporary is not introduced as a result of the use of i().)
80
  template<class T> auto f(T) // #2
81
  -> void;
82
  auto g() -> void {
83
- f(42); // OK: calls #2. (#1 is not a viable candidate: type deduction
84
  // fails[temp.deduct] because A<int>::~A() is implicitly used in its
85
  // decltype-specifier)
86
  }
87
  template<class T> auto q(T)
88
  -> decltype((h<T>())); // does not force completion of A<T>; A<T>::~A() is not implicitly
 
12
  [[dcl.struct.bind]], `decltype(E)` is the referenced type as given in
13
  the specification of the structured binding declaration;
14
  - otherwise, if E is an unparenthesized *id-expression* naming a
15
  non-type *template-parameter* [[temp.param]], `decltype(E)` is the
16
  type of the *template-parameter* after performing any necessary type
17
+ deduction [[dcl.spec.auto]], [[dcl.type.class.deduct]];
18
  - otherwise, if E is an unparenthesized *id-expression* or an
19
  unparenthesized class member access [[expr.ref]], `decltype(E)` is the
20
+ type of the entity named by E. If there is no such entity, the program
21
+ is ill-formed;
22
  - otherwise, if E is an xvalue, `decltype(E)` is `T&&`, where `T` is the
23
  type of E;
24
  - otherwise, if E is an lvalue, `decltype(E)` is `T&`, where `T` is the
25
  type of E;
26
  - otherwise, `decltype(E)` is the type of E.
27
 
28
  The operand of the `decltype` specifier is an unevaluated operand
29
+ [[term.unevaluated.operand]].
30
 
31
  [*Example 1*:
32
 
33
  ``` cpp
34
  const int&& foo();
 
78
  // for the temporary introduced by the use of h().
79
  // (A temporary is not introduced as a result of the use of i().)
80
  template<class T> auto f(T) // #2
81
  -> void;
82
  auto g() -> void {
83
+ f(42); // OK, calls #2. (#1 is not a viable candidate: type deduction
84
  // fails[temp.deduct] because A<int>::~A() is implicitly used in its
85
  // decltype-specifier)
86
  }
87
  template<class T> auto q(T)
88
  -> decltype((h<T>())); // does not force completion of A<T>; A<T>::~A() is not implicitly