From Jason Turner

[expr.prim.id.unqual]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpzoxrv1l1/{from.md → to.md} +54 -14
tmp/tmpzoxrv1l1/{from.md → to.md} RENAMED
@@ -4,28 +4,68 @@
4
  unqualified-id:
5
  identifier
6
  operator-function-id
7
  conversion-function-id
8
  literal-operator-id
9
- '~' class-name
10
  '~' decltype-specifier
11
  template-id
12
  ```
13
 
14
- An *identifier* is an *id-expression* provided it has been suitably
15
- declared (Clause  [[dcl.dcl]]).
 
 
16
 
17
  [*Note 1*: For *operator-function-id*s, see  [[over.oper]]; for
18
  *conversion-function-id*s, see  [[class.conv.fct]]; for
19
  *literal-operator-id*s, see  [[over.literal]]; for *template-id*s, see 
20
- [[temp.names]]. A *class-name* or *decltype-specifier* prefixed by `~`
21
- denotes a destructor; see  [[class.dtor]]. Within the definition of a
22
- non-static member function, an *identifier* that names a non-static
23
- member is transformed to a class member access expression (
24
- [[class.mfct.non-static]]). — *end note*]
25
-
26
- The type of the expression is the type of the *identifier*. The result
27
- is the entity denoted by the identifier. The expression is an lvalue if
28
- the entity is a function, variable, or data member and a prvalue
29
- otherwise; it is a bit-field if the identifier designates a bit-field (
30
- [[dcl.struct.bind]]).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
 
 
4
  unqualified-id:
5
  identifier
6
  operator-function-id
7
  conversion-function-id
8
  literal-operator-id
9
+ '~' type-name
10
  '~' decltype-specifier
11
  template-id
12
  ```
13
 
14
+ An *identifier* is only an *id-expression* if it has been suitably
15
+ declared [[dcl.dcl]] or if it appears as part of a *declarator-id*
16
+ [[dcl.decl]]. An *identifier* that names a coroutine parameter refers to
17
+ the copy of the parameter [[dcl.fct.def.coroutine]].
18
 
19
  [*Note 1*: For *operator-function-id*s, see  [[over.oper]]; for
20
  *conversion-function-id*s, see  [[class.conv.fct]]; for
21
  *literal-operator-id*s, see  [[over.literal]]; for *template-id*s, see 
22
+ [[temp.names]]. A *type-name* or *decltype-specifier* prefixed by `~`
23
+ denotes the destructor of the type so named; see  [[expr.prim.id.dtor]].
24
+ Within the definition of a non-static member function, an *identifier*
25
+ that names a non-static member is transformed to a class member access
26
+ expression ([[class.mfct.non-static]]). — *end note*]
27
+
28
+ The result is the entity denoted by the identifier. If the entity is a
29
+ local entity and naming it from outside of an unevaluated operand within
30
+ the declarative region where the *unqualified-id* appears would result
31
+ in some intervening *lambda-expression* capturing it by copy
32
+ [[expr.prim.lambda.capture]], the type of the expression is the type of
33
+ a class member access expression [[expr.ref]] naming the non-static data
34
+ member that would be declared for such a capture in the closure object
35
+ of the innermost such intervening *lambda-expression*.
36
+
37
+ [*Note 2*: If that *lambda-expression* is not declared `mutable`, the
38
+ type of such an identifier will typically be `const`
39
+ qualified. — *end note*]
40
+
41
+ The type of the expression is the type of the result.
42
+
43
+ [*Note 3*: If the entity is a template parameter object for a template
44
+ parameter of type `T` [[temp.param]], the type of the expression is
45
+ `const T`. — *end note*]
46
+
47
+ [*Note 4*: The type will be adjusted as described in [[expr.type]] if
48
+ it is cv-qualified or is a reference type. — *end note*]
49
+
50
+ The expression is an lvalue if the entity is a function, variable,
51
+ structured binding [[dcl.struct.bind]], data member, or template
52
+ parameter object and a prvalue otherwise [[basic.lval]]; it is a
53
+ bit-field if the identifier designates a bit-field.
54
+
55
+ [*Example 1*:
56
+
57
+ ``` cpp
58
+ void f() {
59
+ float x, &r = x;
60
+ [=] {
61
+ decltype(x) y1; // y1 has type float
62
+ decltype((x)) y2 = y1; // y2 has type float const& because this lambda
63
+ // is not mutable and x is an lvalue
64
+ decltype(r) r1 = y1; // r1 has type float&
65
+ decltype((r)) r2 = y2; // r2 has type float const&
66
+ };
67
+ }
68
+ ```
69
+
70
+ — *end example*]
71