From Jason Turner

[expr.prim.this]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpj2mqgs95/{from.md → to.md} +12 -12
tmp/tmpj2mqgs95/{from.md → to.md} RENAMED
@@ -1,10 +1,10 @@
1
  ### This <a id="expr.prim.this">[[expr.prim.this]]</a>
2
 
3
  The keyword `this` names a pointer to the object for which a non-static
4
- member function ([[class.this]]) is invoked or a non-static data
5
- member’s initializer ([[class.mem]]) is evaluated.
6
 
7
  If a declaration declares a member function or member function template
8
  of a class `X`, the expression `this` is a prvalue of type “pointer to
9
  *cv-qualifier-seq* `X`” between the optional *cv-qualifier-seq* and the
10
  end of the *function-definition*, *member-declarator*, or *declarator*.
@@ -14,16 +14,15 @@ its type and value category are defined within a static member function
14
  as they are within a non-static member function).
15
 
16
  [*Note 1*: This is because declaration matching does not occur until
17
  the complete declarator is known. — *end note*]
18
 
19
- Unlike the object expression in other contexts, `*this` is not required
20
- to be of complete type for purposes of class member access (
21
- [[expr.ref]]) outside the member function body.
22
 
23
- [*Note 2*: Only class members declared prior to the declaration are
24
- visible. *end note*]
 
25
 
26
  [*Example 1*:
27
 
28
  ``` cpp
29
  struct A {
@@ -34,15 +33,16 @@ struct A {
34
  template auto A::f(int t) -> decltype(t + g());
35
  ```
36
 
37
  — *end example*]
38
 
39
- Otherwise, if a *member-declarator* declares a non-static data member (
40
- [[class.mem]]) of a class `X`, the expression `this` is a prvalue of
41
- type “pointer to `X`” within the optional default member initializer (
42
- [[class.mem]]). It shall not appear elsewhere in the
43
- *member-declarator*.
 
44
 
45
  The expression `this` shall not appear in any other context.
46
 
47
  [*Example 2*:
48
 
 
1
  ### This <a id="expr.prim.this">[[expr.prim.this]]</a>
2
 
3
  The keyword `this` names a pointer to the object for which a non-static
4
+ member function [[class.this]] is invoked or a non-static data member’s
5
+ initializer [[class.mem]] is evaluated.
6
 
7
  If a declaration declares a member function or member function template
8
  of a class `X`, the expression `this` is a prvalue of type “pointer to
9
  *cv-qualifier-seq* `X`” between the optional *cv-qualifier-seq* and the
10
  end of the *function-definition*, *member-declarator*, or *declarator*.
 
14
  as they are within a non-static member function).
15
 
16
  [*Note 1*: This is because declaration matching does not occur until
17
  the complete declarator is known. — *end note*]
18
 
19
+ [*Note 2*:
 
 
20
 
21
+ In a *trailing-return-type*, the class being defined is not required to
22
+ be complete for purposes of class member access [[expr.ref]]. Class
23
+ members declared later are not visible.
24
 
25
  [*Example 1*:
26
 
27
  ``` cpp
28
  struct A {
 
33
  template auto A::f(int t) -> decltype(t + g());
34
  ```
35
 
36
  — *end example*]
37
 
38
+ *end note*]
39
+
40
+ Otherwise, if a *member-declarator* declares a non-static data member
41
+ [[class.mem]] of a class `X`, the expression `this` is a prvalue of type
42
+ “pointer to `X`” within the optional default member initializer
43
+ [[class.mem]]. It shall not appear elsewhere in the *member-declarator*.
44
 
45
  The expression `this` shall not appear in any other context.
46
 
47
  [*Example 2*:
48