From Jason Turner

[dcl.type.simple]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp5g3v0m92/{from.md → to.md} +14 -10
tmp/tmp5g3v0m92/{from.md → to.md} RENAMED
@@ -32,18 +32,19 @@ type-name:
32
  ```
33
 
34
  ``` bnf
35
  decltype-specifier:
36
  'decltype' '(' expression ')'
 
37
  ```
38
 
39
  The `auto` specifier is a placeholder for a type to be deduced (
40
  [[dcl.spec.auto]]). The other *simple-type-specifier*s specify either a
41
- previously-declared user-defined type or one of the fundamental types (
42
- [[basic.fundamental]]). Table  [[tab:simple.type.specifiers]] summarizes
43
- the valid combinations of *simple-type-specifier*s and the types they
44
- specify.
45
 
46
  **Table: *simple-type-specifier*{s} and the types they specify** <a id="tab:simple.type.specifiers">[tab:simple.type.specifiers]</a>
47
 
48
  | | |
49
  | ---------------------- | -------------------------------------- |
@@ -87,16 +88,16 @@ specify.
87
  | decltype(*expression*) | the type as defined below |
88
 
89
 
90
  When multiple *simple-type-specifiers* are allowed, they can be freely
91
  intermixed with other *decl-specifiers* in any order. It is
92
- implementation-defined whether objects of `char` type and certain
93
- bit-fields ([[class.bit]]) are represented as signed or unsigned
94
- quantities. The `signed` specifier forces `char` objects and bit-fields
95
- to be signed; it is redundant in other contexts.
96
 
97
- The type denoted by `decltype(e)` is defined as follows:
 
98
 
99
  - if `e` is an unparenthesized *id-expression* or an unparenthesized
100
  class member access ([[expr.ref]]), `decltype(e)` is the type of the
101
  entity named by `e`. If there is no such entity, or if `e` names a set
102
  of overloaded functions, the program is ill-formed;
@@ -112,16 +113,19 @@ The operand of the `decltype` specifier is an unevaluated operand
112
  ``` cpp
113
  const int&& foo();
114
  int i;
115
  struct A { double x; };
116
  const A* a = new A();
117
- decltype(foo()) x1 = i; // type is const int&&
118
  decltype(i) x2; // type is int
119
  decltype(a->x) x3; // type is double
120
  decltype((a->x)) x4 = x3; // type is const double&
121
  ```
122
 
 
 
 
123
  in the case where the operand of a *decltype-specifier* is a function
124
  call and the return type of the function is a class type, a special
125
  rule ([[expr.call]]) ensures that the return type is not required to be
126
  complete (as it would be if the call appeared in a sub-expression or
127
  outside of a *decltype-specifier*). In this context, the common purpose
 
32
  ```
33
 
34
  ``` bnf
35
  decltype-specifier:
36
  'decltype' '(' expression ')'
37
+ 'decltype' '(' 'auto' ')'
38
  ```
39
 
40
  The `auto` specifier is a placeholder for a type to be deduced (
41
  [[dcl.spec.auto]]). The other *simple-type-specifier*s specify either a
42
+ previously-declared type, a type determined from an expression, or one
43
+ of the fundamental types ([[basic.fundamental]]). Table 
44
+ [[tab:simple.type.specifiers]] summarizes the valid combinations of
45
+ *simple-type-specifier*s and the types they specify.
46
 
47
  **Table: *simple-type-specifier*{s} and the types they specify** <a id="tab:simple.type.specifiers">[tab:simple.type.specifiers]</a>
48
 
49
  | | |
50
  | ---------------------- | -------------------------------------- |
 
88
  | decltype(*expression*) | the type as defined below |
89
 
90
 
91
  When multiple *simple-type-specifiers* are allowed, they can be freely
92
  intermixed with other *decl-specifiers* in any order. It is
93
+ implementation-defined whether objects of `char` type are represented as
94
+ signed or unsigned quantities. The `signed` specifier forces `char`
95
+ objects to be signed; it is redundant in other contexts.
 
96
 
97
+ For an expression `e`, the type denoted by `decltype(e)` is defined as
98
+ follows:
99
 
100
  - if `e` is an unparenthesized *id-expression* or an unparenthesized
101
  class member access ([[expr.ref]]), `decltype(e)` is the type of the
102
  entity named by `e`. If there is no such entity, or if `e` names a set
103
  of overloaded functions, the program is ill-formed;
 
113
  ``` cpp
114
  const int&& foo();
115
  int i;
116
  struct A { double x; };
117
  const A* a = new A();
118
+ decltype(foo()) x1 = 0; // type is const int&&
119
  decltype(i) x2; // type is int
120
  decltype(a->x) x3; // type is double
121
  decltype((a->x)) x4 = x3; // type is const double&
122
  ```
123
 
124
+ The rules for determining types involving `decltype(auto)` are specified
125
+ in  [[dcl.spec.auto]].
126
+
127
  in the case where the operand of a *decltype-specifier* is a function
128
  call and the return type of the function is a class type, a special
129
  rule ([[expr.call]]) ensures that the return type is not required to be
130
  complete (as it would be if the call appeared in a sub-expression or
131
  outside of a *decltype-specifier*). In this context, the common purpose