From Jason Turner

[expr.post]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp_ov6ec_3/{from.md → to.md} +125 -112
tmp/tmp_ov6ec_3/{from.md → to.md} RENAMED
@@ -44,64 +44,67 @@ The `>` token following the in a `dynamic_cast`, `static_cast`,
44
  `>{>}` token by two consecutive `>` tokens ([[temp.names]]).
45
 
46
  ### Subscripting <a id="expr.sub">[[expr.sub]]</a>
47
 
48
  A postfix expression followed by an expression in square brackets is a
49
- postfix expression. One of the expressions shall have the type “pointer
50
- to `T`” and the other shall have unscoped enumeration or integral type.
51
- The result is an lvalue of type “`T`.” The type “`T`” shall be a
52
  completely-defined object type.[^5] The expression `E1[E2]` is identical
53
  (by definition) to `*((E1)+(E2))` see  [[expr.unary]] and  [[expr.add]]
54
- for details of `*` and `+` and  [[dcl.array]] for details of arrays.
 
 
55
 
56
  A *braced-init-list* shall not be used with the built-in subscript
57
  operator.
58
 
59
  ### Function call <a id="expr.call">[[expr.call]]</a>
60
 
61
- There are two kinds of function call: ordinary function call and member
62
- function[^6] ([[class.mfct]]) call. A function call is a postfix
63
- expression followed by parentheses containing a possibly empty,
64
- comma-separated list of expressions which constitute the arguments to
65
- the function. For an ordinary function call, the postfix expression
66
- shall be either an lvalue that refers to a function (in which case the
67
- function-to-pointer standard conversion ([[conv.func]]) is suppressed
68
- on the postfix expression), or it shall have pointer to function type.
69
- Calling a function through an expression whose function type has a
70
- language linkage that is different from the language linkage of the
71
- function type of the called function’s definition is undefined (
72
- [[dcl.link]]). For a member function call, the postfix expression shall
73
- be an implicit ([[class.mfct.non-static]],  [[class.static]]) or
74
- explicit class member access ([[expr.ref]]) whose *id-expression* is a
75
- function member name, or a pointer-to-member expression (
76
- [[expr.mptr.oper]]) selecting a function member; the call is as a member
77
- of the class object referred to by the object expression. In the case of
78
- an implicit class member access, the implied object is the one pointed
79
- to by `this`. a member function call of the form `f()` is interpreted as
80
- `(*this).f()` (see  [[class.mfct.non-static]]). If a function or member
81
- function name is used, the name can be overloaded (Clause  [[over]]), in
82
- which case the appropriate function shall be selected according to the
83
- rules in  [[over.match]]. If the selected function is non-virtual, or if
84
- the *id-expression* in the class member access expression is a
 
85
  *qualified-id*, that function is called. Otherwise, its final
86
  overrider ([[class.virtual]]) in the dynamic type of the object
87
- expression is called. the dynamic type is the type of the object
88
- referred to by the current value of the object expression.
89
- [[class.cdtor]] describes the behavior of virtual function calls when
90
- the object expression refers to an object under construction or
91
- destruction.
92
 
93
  If a function or member function name is used, and name lookup (
94
  [[basic.lookup]]) does not find a declaration of that name, the program
95
  is ill-formed. No function is implicitly declared by such a call.
96
 
97
  If the *postfix-expression* designates a destructor ([[class.dtor]]),
98
  the type of the function call expression is `void`; otherwise, the type
99
  of the function call expression is the return type of the statically
100
  chosen function (i.e., ignoring the `virtual` keyword), even if the type
101
- of the function actually called is different. This type shall be an
102
- object type, a reference type or the type `void`.
103
 
104
  When a function is called, each parameter ([[dcl.fct]]) shall be
105
  initialized ([[dcl.init]],  [[class.copy]],  [[class.ctor]]) with its
106
  corresponding argument. Such initializations are indeterminately
107
  sequenced with respect to each other ([[intro.execution]]) If the
@@ -174,16 +177,16 @@ enumeration type that is subject to the integral promotions (
174
  [[conv.prom]]), or a floating point type that is subject to the floating
175
  point promotion ([[conv.fpprom]]), the value of the argument is
176
  converted to the promoted type before the call. These promotions are
177
  referred to as the *default argument promotions*.
178
 
179
- The evaluations of the postfix expression and of the argument
180
- expressions are all unsequenced relative to one another. All side
181
- effects of argument expression evaluations are sequenced before the
182
- function is entered (see  [[intro.execution]]).
183
 
184
- Recursive calls are permitted, except to the function named `main` (
185
  [[basic.start.main]]).
186
 
187
  A function call is an lvalue if the result type is an lvalue reference
188
  type or an rvalue reference to function type, an xvalue if the result
189
  type is an rvalue reference to object type, and a prvalue otherwise.
@@ -223,14 +226,15 @@ temporary variable `t`, with the result being the value of `t` as a
223
  prvalue.
224
 
225
  The expression `T()`, where `T` is a *simple-type-specifier* or
226
  *typename-specifier* for a non-array complete object type or the
227
  (possibly cv-qualified) `void` type, creates a prvalue of the specified
228
- type,which is value-initialized ([[dcl.init]]; no initialization is
229
- done for the `void()` case). if `T` is a non-class type that is
230
- cv-qualified, the *cv-qualifier*s are ignored when determining the type
231
- of the resulting prvalue ([[basic.lval]]).
 
232
 
233
  Similarly, a *simple-type-specifier* or *typename-specifier* followed by
234
  a *braced-init-list* creates a temporary object of the specified type
235
  direct-list-initialized ([[dcl.init.list]]) with the specified
236
  *braced-init-list*, and its value is that temporary object as a prvalue.
@@ -260,19 +264,19 @@ shall designate the same scalar type.
260
  ### Class member access <a id="expr.ref">[[expr.ref]]</a>
261
 
262
  A postfix expression followed by a dot `.` or an arrow `->`, optionally
263
  followed by the keyword `template` ([[temp.names]]), and then followed
264
  by an *id-expression*, is a postfix expression. The postfix expression
265
- before the dot or arrow is evaluated;[^7] the result of that evaluation,
266
  together with the *id-expression*, determines the result of the entire
267
  postfix expression.
268
 
269
  For the first option (dot) the first expression shall have complete
270
  class type. For the second option (arrow) the first expression shall
271
  have pointer to complete class type. The expression `E1->E2` is
272
  converted to the equivalent form `(*(E1)).E2`; the remainder of
273
- [[expr.ref]] will address only the first option (dot).[^8] In either
274
  case, the *id-expression* shall name a member of the class or of one of
275
  its base classes. because the name of a class is inserted in its class
276
  scope (Clause  [[class]]), the name of a class is also considered a
277
  nested member of that class. [[basic.lookup.classref]] describes how
278
  names are looked up after the `.` and `->` operators.
@@ -292,19 +296,19 @@ rules applies.
292
  `E1.E2` is an lvalue; the expression designates the named member of
293
  the class. The type of `E1.E2` is `T`.
294
  - If `E2` is a non-static data member and the type of `E1` is “*cq1 vq1*
295
  `X`”, and the type of `E2` is “*cq2 vq2* `T`”, the expression
296
  designates the named member of the object designated by the first
297
- expression. If `E1` is an lvalue, then `E1.E2` is an lvalue; if `E1`
298
- is an xvalue, then `E1.E2` is an xvalue; otherwise, it is a prvalue.
299
- Let the notation *vq12* stand for the “union” of *vq1* and *vq2*; that
300
- is, if *vq1* or *vq2* is `volatile`, then *vq12* is `volatile`.
301
- Similarly, let the notation *cq12* stand for the “union” of *cq1* and
302
- *cq2*; that is, if *cq1* or *cq2* is `const`, then *cq12* is `const`.
303
- If `E2` is declared to be a `mutable` member, then the type of `E1.E2`
304
- is “*vq12* `T`”. If `E2` is not declared to be a `mutable` member,
305
- then the type of `E1.E2` is “*cq12* *vq12* `T`”.
306
  - If `E2` is a (possibly overloaded) member function, function overload
307
  resolution ([[over.match]]) is used to determine whether `E1.E2`
308
  refers to a static or a non-static member function.
309
  - If it refers to a static member function and the type of `E2` is
310
  “function of parameter-type-list returning `T`”, then `E1.E2` is an
@@ -377,11 +381,11 @@ result is the null pointer value of type `T`.
377
  If `T` is “pointer to *cv1* `B`” and `v` has type “pointer to *cv2* `D`”
378
  such that `B` is a base class of `D`, the result is a pointer to the
379
  unique `B` subobject of the `D` object pointed to by `v`. Similarly, if
380
  `T` is “reference to *cv1* `B`” and `v` has type *cv2* `D` such that `B`
381
  is a base class of `D`, the result is the unique `B` subobject of the
382
- `D` object referred to by `v`. [^9] The result is an lvalue if `T` is an
383
  lvalue reference, or an xvalue if `T` is an rvalue reference. In both
384
  the pointer and reference cases, the program is ill-formed if *cv2* has
385
  greater cv-qualification than *cv1* or if `B` is an inaccessible or
386
  ambiguous base class of `D`.
387
 
@@ -391,11 +395,11 @@ struct D : B { };
391
  void foo(D* dp) {
392
  B* bp = dynamic_cast<B*>(dp); // equivalent to B* bp = dp;
393
  }
394
  ```
395
 
396
- Otherwise, `v` shall be a pointer to or an lvalue of a polymorphic
397
  type ([[class.virtual]]).
398
 
399
  If `T` is “pointer to *cv* `void`,” then the result is a pointer to the
400
  most derived object pointed to by `v`. Otherwise, a run-time check is
401
  applied to see if the object pointed or referred to by `v` can be
@@ -415,12 +419,13 @@ check logically executes as follows:
415
  result points (refers) to the `C` subobject of the most derived
416
  object.
417
  - Otherwise, the run-time check *fails*.
418
 
419
  The value of a failed cast to pointer type is the null pointer value of
420
- the required result type. A failed cast to reference type throws
421
- `std::bad_cast` ([[bad.cast]]).
 
422
 
423
  ``` cpp
424
  class A { virtual void f(); };
425
  class B { virtual void g(); };
426
  class D : public virtual A, private B { };
@@ -454,22 +459,23 @@ object under construction or destruction.
454
 
455
  The result of a `typeid` expression is an lvalue of static type `const`
456
  `std::type_info` ([[type.info]]) and dynamic type `const`
457
  `std::type_info` or `const` *name* where *name* is an
458
  *implementation-defined* class publicly derived from `std :: type_info`
459
- which preserves the behavior described in  [[type.info]].[^10] The
460
  lifetime of the object referred to by the lvalue extends to the end of
461
  the program. Whether or not the destructor is called for the
462
  `std::type_info` object at the end of the program is unspecified.
463
 
464
  When `typeid` is applied to a glvalue expression whose type is a
465
  polymorphic class type ([[class.virtual]]), the result refers to a
466
  `std::type_info` object representing the type of the most derived
467
  object ([[intro.object]]) (that is, the dynamic type) to which the
468
  glvalue refers. If the glvalue expression is obtained by applying the
469
- unary `*` operator to a pointer[^11] and the pointer is a null pointer
470
- value ([[conv.ptr]]), the `typeid` expression throws the
 
471
  `std::bad_typeid` exception ([[bad.typeid]]).
472
 
473
  When `typeid` is applied to an expression other than a glvalue of a
474
  polymorphic class type, the result refers to a `std::type_info` object
475
  representing the static type of the expression. Lvalue-to-rvalue (
@@ -485,12 +491,13 @@ type of the *type-id* is a reference to a possibly *cv*-qualified type,
485
  the result of the `typeid` expression refers to a `std::type_info`
486
  object representing the *cv*-unqualified referenced type. If the type of
487
  the *type-id* is a class type or a reference to a class type, the class
488
  shall be completely-defined.
489
 
490
- The top-level cv-qualifiers of the glvalue expression or the *type-id*
491
- that is the operand of `typeid` are always ignored.
 
492
 
493
  ``` cpp
494
  class D { /* ... */ };
495
  D d1;
496
  const D d2;
@@ -525,30 +532,34 @@ and `B` is neither a virtual base class of `D` nor a base class of a
525
  virtual base class of `D`. The result has type “*cv2* `D`.” An xvalue of
526
  type “*cv1* `B`” may be cast to type “rvalue reference to *cv2* `D`”
527
  with the same constraints as for an lvalue of type “*cv1* `B`.” If the
528
  object of type “*cv1* `B`” is actually a subobject of an object of type
529
  `D`, the result refers to the enclosing object of type `D`. Otherwise,
530
- the result of the cast is undefined.
531
 
532
  ``` cpp
533
  struct B { };
534
  struct D : public B { };
535
  D d;
536
  B &br = d;
537
 
538
  static_cast<D&>(br); // produces lvalue to the original d object
539
  ```
540
 
541
- A glvalue of type “*cv1* `T1`” can be cast to type “rvalue reference to
542
- *cv2* `T2`” if “*cv2* `T2`” is reference-compatible with “*cv1* `T1`” (
543
- [[dcl.init.ref]]). The result refers to the object or the specified base
544
- class subobject thereof. If `T2` is an inaccessible (Clause 
 
 
 
 
545
  [[class.access]]) or ambiguous ([[class.member.lookup]]) base class of
546
  `T1`, a program that necessitates such a cast is ill-formed.
547
 
548
- Otherwise, an expression `e` can be explicitly converted to a type `T`
549
- using a `static_cast` of the form `static_cast<T>(e)` if the declaration
550
  `T t(e);` is well-formed, for some invented temporary variable `t` (
551
  [[dcl.init]]). The effect of such an explicit conversion is the same as
552
  performing the declaration and initialization and then using the
553
  temporary variable as the result of the conversion. The expression `e`
554
  is used as a glvalue if and only if the initialization uses it as a
@@ -588,24 +599,27 @@ are applied to the operand. Such a `static_cast` is subject to the
588
  restriction that the explicit conversion does not cast away constness (
589
  [[expr.const.cast]]), and the following additional rules for specific
590
  cases:
591
 
592
  A value of a scoped enumeration type ([[dcl.enum]]) can be explicitly
593
- converted to an integral type. The value is unchanged if the original
594
- value can be represented by the specified type. Otherwise, the resulting
595
- value is unspecified. A value of a scoped enumeration type can also be
596
- explicitly converted to a floating-point type; the result is the same as
597
- that of converting from the original value to the floating-point type.
 
 
 
598
 
599
  A value of integral or enumeration type can be explicitly converted to
600
  an enumeration type. The value is unchanged if the original value is
601
  within the range of the enumeration values ([[dcl.enum]]). Otherwise,
602
  the resulting value is unspecified (and might not be in that range). A
603
- value of floating-point type can also be converted to an enumeration
604
- type. The resulting value is the same as converting the original value
605
- to the underlying type of the enumeration ([[conv.fpint]]), and
606
- subsequently to the enumeration type.
607
 
608
  A prvalue of type “pointer to *cv1* `B`,” where `B` is a class type, can
609
  be converted to a prvalue of type “pointer to *cv2* `D`,” where `D` is a
610
  class derived (Clause  [[class.derived]]) from `B`, if a valid standard
611
  conversion from “pointer to `D`” to “pointer to `B`” exists (
@@ -614,34 +628,38 @@ cv-qualification than, *cv1*, and `B` is neither a virtual base class of
614
  `D` nor a base class of a virtual base class of `D`. The null pointer
615
  value ([[conv.ptr]]) is converted to the null pointer value of the
616
  destination type. If the prvalue of type “pointer to *cv1* `B`” points
617
  to a `B` that is actually a subobject of an object of type `D`, the
618
  resulting pointer points to the enclosing object of type `D`. Otherwise,
619
- the result of the cast is undefined.
620
 
621
  A prvalue of type “pointer to member of `D` of type *cv1* `T`” can be
622
  converted to a prvalue of type “pointer to member of `B`” of type *cv2*
623
  `T`, where `B` is a base class (Clause  [[class.derived]]) of `D`, if a
624
  valid standard conversion from “pointer to member of `B` of type `T`” to
625
  “pointer to member of `D` of type `T`” exists ([[conv.mem]]), and *cv2*
626
  is the same cv-qualification as, or greater cv-qualification than,
627
- *cv1*.[^12] The null member pointer value ([[conv.mem]]) is converted
628
  to the null member pointer value of the destination type. If class `B`
629
  contains the original member, or is a base or derived class of the class
630
  containing the original member, the resulting pointer to member points
631
- to the original member. Otherwise, the result of the cast is undefined.
632
- although class `B` need not contain the original member, the dynamic
633
- type of the object on which the pointer to member is dereferenced must
634
- contain the original member; see  [[expr.mptr.oper]].
635
 
636
  A prvalue of type “pointer to *cv1* `void`” can be converted to a
637
  prvalue of type “pointer to *cv2* `T`,” where `T` is an object type and
638
  *cv2* is the same cv-qualification as, or greater cv-qualification than,
639
  *cv1*. The null pointer value is converted to the null pointer value of
640
- the destination type. A value of type pointer to object converted to
641
- “pointer to *cv* `void` and back, possibly with different
642
- cv-qualification, shall have its original value.
 
 
 
 
643
 
644
  ``` cpp
645
  T* p1 = new T;
646
  const T* p2 = static_cast<const T*>(static_cast<void*>(p1));
647
  bool b = p1 == p2; // b will have the value true.
@@ -694,20 +712,17 @@ prvalue of type “pointer to `T1`” to the type “pointer to `T2`” (where
694
  the original pointer value, the result of such a pointer conversion is
695
  unspecified. see also  [[conv.ptr]] for more details of pointer
696
  conversions.
697
 
698
  An object pointer can be explicitly converted to an object pointer of a
699
- different type.[^13] When a prvalue `v` of type pointer to `T1`” is
700
- converted to the type “pointer to cv `T2`”, the result is
701
- `static_cast<cv T2*>(static_cast<cv void*>(v))` if both `T1` and `T2`
702
- are standard-layout types ([[basic.types]]) and the alignment
703
- requirements of `T2` are no stricter than those of `T1`, or if either
704
- type is `void`. Converting a prvalue of type “pointer to `T1` to the
705
- type pointer to `T2`” (where `T1` and `T2` are object types and where
706
- the alignment requirements of `T2` are no stricter than those of `T1`)
707
- and back to its original type yields the original pointer value. The
708
- result of any other such pointer conversion is unspecified.
709
 
710
  Converting a function pointer to an object pointer type or vice versa is
711
  conditionally-supported. The meaning of such a conversion is
712
  *implementation-defined*, except that if an implementation supports
713
  conversions in both directions, converting a prvalue of one type to the
@@ -721,11 +736,11 @@ pointer constant of integral type is not necessarily converted to a null
721
  pointer value.
722
 
723
  A prvalue of type “pointer to member of `X` of type `T1`” can be
724
  explicitly converted to a prvalue of a different type “pointer to member
725
  of `Y` of type `T2`” if `T1` and `T2` are both function types or both
726
- object types.[^14] The null member pointer value ([[conv.mem]]) is
727
  converted to the null member pointer value of the destination type. The
728
  result of this conversion is unspecified, except in the following cases:
729
 
730
  - converting a prvalue of type “pointer to member function” to a
731
  different pointer to member function type and back to its original
@@ -734,22 +749,20 @@ result of this conversion is unspecified, except in the following cases:
734
  `T1`” to the type “pointer to data member of `Y` of type `T2`” (where
735
  the alignment requirements of `T2` are no stricter than those of `T1`)
736
  and back to its original type yields the original pointer to member
737
  value.
738
 
739
- An lvalue expression of type `T1` can be cast to the type “reference to
740
  `T2`” if an expression of type “pointer to `T1`” can be explicitly
741
- converted to the type “pointer to `T2`” using a `reinterpret_cast`. That
742
- is, a reference cast `reinterpret_cast<T&>(x)` has the same effect as
743
- the conversion `*reinterpret_cast<T*>(&x)` with the built-in `&` and `*`
744
- operators (and similarly for `reinterpret_cast<T&&>(x)`). The result
745
- refers to the same object as the source lvalue, but with a different
746
- type. The result is an lvalue for an lvalue reference type or an rvalue
747
- reference to function type and an xvalue for an rvalue reference to
748
- object type. No temporary is created, no copy is made, and
749
- constructors ([[class.ctor]]) or conversion functions ([[class.conv]])
750
- are not called.[^15]
751
 
752
  ### Const cast <a id="expr.const.cast">[[expr.const.cast]]</a>
753
 
754
  The result of the expression `const_cast<T>(v)` is of type `T`. If `T`
755
  is an lvalue reference to object type, the result is an lvalue; if `T`
@@ -801,11 +814,11 @@ value of the destination type. The null member pointer value (
801
  [[conv.mem]]) is converted to the null member pointer value of the
802
  destination type.
803
 
804
  Depending on the type of the object, a write operation through the
805
  pointer, lvalue or pointer to data member resulting from a `const_cast`
806
- that casts away a const-qualifier[^16] may produce undefined behavior (
807
  [[dcl.type.cv]]).
808
 
809
  The following rules define the process known as *casting away
810
  constness*. In these rules `Tn ` and `Xn ` represent types. For two
811
  pointer types:
 
44
  `>{>}` token by two consecutive `>` tokens ([[temp.names]]).
45
 
46
  ### Subscripting <a id="expr.sub">[[expr.sub]]</a>
47
 
48
  A postfix expression followed by an expression in square brackets is a
49
+ postfix expression. One of the expressions shall have the type “array of
50
+ `T`” or “pointer to `T`” and the other shall have unscoped enumeration
51
+ or integral type. The result is of type “`T`.” The type “`T`” shall be a
52
  completely-defined object type.[^5] The expression `E1[E2]` is identical
53
  (by definition) to `*((E1)+(E2))` see  [[expr.unary]] and  [[expr.add]]
54
+ for details of `*` and `+` and  [[dcl.array]] for details of arrays. ,
55
+ except that in the case of an array operand, the result is an lvalue if
56
+ that operand is an lvalue and an xvalue otherwise.
57
 
58
  A *braced-init-list* shall not be used with the built-in subscript
59
  operator.
60
 
61
  ### Function call <a id="expr.call">[[expr.call]]</a>
62
 
63
+ A function call is a postfix expression followed by parentheses
64
+ containing a possibly empty, comma-separated list of
65
+ *initializer-clause*s which constitute the arguments to the function.
66
+ The postfix expression shall have function type or pointer to function
67
+ type. For a call to a non-member function or to a static member
68
+ function, the postfix expression shall be either an lvalue that refers
69
+ to a function (in which case the function-to-pointer standard
70
+ conversion ([[conv.func]]) is suppressed on the postfix expression), or
71
+ it shall have pointer to function type. Calling a function through an
72
+ expression whose function type has a language linkage that is different
73
+ from the language linkage of the function type of the called function’s
74
+ definition is undefined ([[dcl.link]]). For a call to a non-static
75
+ member function, the postfix expression shall be an implicit (
76
+ [[class.mfct.non-static]],  [[class.static]]) or explicit class member
77
+ access ([[expr.ref]]) whose *id-expression* is a function member name,
78
+ or a pointer-to-member expression ([[expr.mptr.oper]]) selecting a
79
+ function member; the call is as a member of the class object referred to
80
+ by the object expression. In the case of an implicit class member
81
+ access, the implied object is the one pointed to by `this`. a member
82
+ function call of the form `f()` is interpreted as `(*this).f()` (see 
83
+ [[class.mfct.non-static]]). If a function or member function name is
84
+ used, the name can be overloaded (Clause  [[over]]), in which case the
85
+ appropriate function shall be selected according to the rules in 
86
+ [[over.match]]. If the selected function is non-virtual, or if the
87
+ *id-expression* in the class member access expression is a
88
  *qualified-id*, that function is called. Otherwise, its final
89
  overrider ([[class.virtual]]) in the dynamic type of the object
90
+ expression is called; such a call is referred to as a *virtual function
91
+ call*. the dynamic type is the type of the object referred to by the
92
+ current value of the object expression. [[class.cdtor]] describes the
93
+ behavior of virtual function calls when the object expression refers to
94
+ an object under construction or destruction.
95
 
96
  If a function or member function name is used, and name lookup (
97
  [[basic.lookup]]) does not find a declaration of that name, the program
98
  is ill-formed. No function is implicitly declared by such a call.
99
 
100
  If the *postfix-expression* designates a destructor ([[class.dtor]]),
101
  the type of the function call expression is `void`; otherwise, the type
102
  of the function call expression is the return type of the statically
103
  chosen function (i.e., ignoring the `virtual` keyword), even if the type
104
+ of the function actually called is different. This return type shall be
105
+ an object type, a reference type or cv `void`.
106
 
107
  When a function is called, each parameter ([[dcl.fct]]) shall be
108
  initialized ([[dcl.init]],  [[class.copy]],  [[class.ctor]]) with its
109
  corresponding argument. Such initializations are indeterminately
110
  sequenced with respect to each other ([[intro.execution]]) If the
 
177
  [[conv.prom]]), or a floating point type that is subject to the floating
178
  point promotion ([[conv.fpprom]]), the value of the argument is
179
  converted to the promoted type before the call. These promotions are
180
  referred to as the *default argument promotions*.
181
 
182
+ The evaluations of the postfix expression and of the arguments are all
183
+ unsequenced relative to one another. All side effects of argument
184
+ evaluations are sequenced before the function is entered (see 
185
+ [[intro.execution]]).
186
 
187
+ Recursive calls are permitted, except to the `main` function (
188
  [[basic.start.main]]).
189
 
190
  A function call is an lvalue if the result type is an lvalue reference
191
  type or an rvalue reference to function type, an xvalue if the result
192
  type is an rvalue reference to object type, and a prvalue otherwise.
 
226
  prvalue.
227
 
228
  The expression `T()`, where `T` is a *simple-type-specifier* or
229
  *typename-specifier* for a non-array complete object type or the
230
  (possibly cv-qualified) `void` type, creates a prvalue of the specified
231
+ type, whose value is that produced by value-initializing ([[dcl.init]])
232
+ an object of type `T`; no initialization is done for the `void()` case.
233
+ if `T` is a non-class type that is cv-qualified, the *cv-qualifier*s are
234
+ discarded when determining the type of the resulting prvalue (Clause 
235
+ [[expr]]).
236
 
237
  Similarly, a *simple-type-specifier* or *typename-specifier* followed by
238
  a *braced-init-list* creates a temporary object of the specified type
239
  direct-list-initialized ([[dcl.init.list]]) with the specified
240
  *braced-init-list*, and its value is that temporary object as a prvalue.
 
264
  ### Class member access <a id="expr.ref">[[expr.ref]]</a>
265
 
266
  A postfix expression followed by a dot `.` or an arrow `->`, optionally
267
  followed by the keyword `template` ([[temp.names]]), and then followed
268
  by an *id-expression*, is a postfix expression. The postfix expression
269
+ before the dot or arrow is evaluated;[^6] the result of that evaluation,
270
  together with the *id-expression*, determines the result of the entire
271
  postfix expression.
272
 
273
  For the first option (dot) the first expression shall have complete
274
  class type. For the second option (arrow) the first expression shall
275
  have pointer to complete class type. The expression `E1->E2` is
276
  converted to the equivalent form `(*(E1)).E2`; the remainder of
277
+ [[expr.ref]] will address only the first option (dot).[^7] In either
278
  case, the *id-expression* shall name a member of the class or of one of
279
  its base classes. because the name of a class is inserted in its class
280
  scope (Clause  [[class]]), the name of a class is also considered a
281
  nested member of that class. [[basic.lookup.classref]] describes how
282
  names are looked up after the `.` and `->` operators.
 
296
  `E1.E2` is an lvalue; the expression designates the named member of
297
  the class. The type of `E1.E2` is `T`.
298
  - If `E2` is a non-static data member and the type of `E1` is “*cq1 vq1*
299
  `X`”, and the type of `E2` is “*cq2 vq2* `T`”, the expression
300
  designates the named member of the object designated by the first
301
+ expression. If `E1` is an lvalue, then `E1.E2` is an lvalue; otherwise
302
+ `E1.E2` is an xvalue. Let the notation *vq12* stand for the “union” of
303
+ *vq1* and *vq2*; that is, if *vq1* or *vq2* is `volatile`, then *vq12*
304
+ is `volatile`. Similarly, let the notation *cq12* stand for the
305
+ “union” of *cq1* and *cq2*; that is, if *cq1* or *cq2* is `const`,
306
+ then *cq12* is `const`. If `E2` is declared to be a `mutable` member,
307
+ then the type of `E1.E2` is “*vq12* `T`”. If `E2` is not declared to
308
+ be a `mutable` member, then the type of `E1.E2` is “*cq12* *vq12*
309
+ `T`”.
310
  - If `E2` is a (possibly overloaded) member function, function overload
311
  resolution ([[over.match]]) is used to determine whether `E1.E2`
312
  refers to a static or a non-static member function.
313
  - If it refers to a static member function and the type of `E2` is
314
  “function of parameter-type-list returning `T`”, then `E1.E2` is an
 
381
  If `T` is “pointer to *cv1* `B`” and `v` has type “pointer to *cv2* `D`”
382
  such that `B` is a base class of `D`, the result is a pointer to the
383
  unique `B` subobject of the `D` object pointed to by `v`. Similarly, if
384
  `T` is “reference to *cv1* `B`” and `v` has type *cv2* `D` such that `B`
385
  is a base class of `D`, the result is the unique `B` subobject of the
386
+ `D` object referred to by `v`. [^8] The result is an lvalue if `T` is an
387
  lvalue reference, or an xvalue if `T` is an rvalue reference. In both
388
  the pointer and reference cases, the program is ill-formed if *cv2* has
389
  greater cv-qualification than *cv1* or if `B` is an inaccessible or
390
  ambiguous base class of `D`.
391
 
 
395
  void foo(D* dp) {
396
  B* bp = dynamic_cast<B*>(dp); // equivalent to B* bp = dp;
397
  }
398
  ```
399
 
400
+ Otherwise, `v` shall be a pointer to or a glvalue of a polymorphic
401
  type ([[class.virtual]]).
402
 
403
  If `T` is “pointer to *cv* `void`,” then the result is a pointer to the
404
  most derived object pointed to by `v`. Otherwise, a run-time check is
405
  applied to see if the object pointed or referred to by `v` can be
 
419
  result points (refers) to the `C` subobject of the most derived
420
  object.
421
  - Otherwise, the run-time check *fails*.
422
 
423
  The value of a failed cast to pointer type is the null pointer value of
424
+ the required result type. A failed cast to reference type throws an
425
+ exception ([[except.throw]]) of a type that would match a handler (
426
+ [[except.handle]]) of type `std::bad_cast` ([[bad.cast]]).
427
 
428
  ``` cpp
429
  class A { virtual void f(); };
430
  class B { virtual void g(); };
431
  class D : public virtual A, private B { };
 
459
 
460
  The result of a `typeid` expression is an lvalue of static type `const`
461
  `std::type_info` ([[type.info]]) and dynamic type `const`
462
  `std::type_info` or `const` *name* where *name* is an
463
  *implementation-defined* class publicly derived from `std :: type_info`
464
+ which preserves the behavior described in  [[type.info]].[^9] The
465
  lifetime of the object referred to by the lvalue extends to the end of
466
  the program. Whether or not the destructor is called for the
467
  `std::type_info` object at the end of the program is unspecified.
468
 
469
  When `typeid` is applied to a glvalue expression whose type is a
470
  polymorphic class type ([[class.virtual]]), the result refers to a
471
  `std::type_info` object representing the type of the most derived
472
  object ([[intro.object]]) (that is, the dynamic type) to which the
473
  glvalue refers. If the glvalue expression is obtained by applying the
474
+ unary `*` operator to a pointer[^10] and the pointer is a null pointer
475
+ value ([[conv.ptr]]), the `typeid` expression throws an exception (
476
+ [[except.throw]]) of a type that would match a handler of type
477
  `std::bad_typeid` exception ([[bad.typeid]]).
478
 
479
  When `typeid` is applied to an expression other than a glvalue of a
480
  polymorphic class type, the result refers to a `std::type_info` object
481
  representing the static type of the expression. Lvalue-to-rvalue (
 
491
  the result of the `typeid` expression refers to a `std::type_info`
492
  object representing the *cv*-unqualified referenced type. If the type of
493
  the *type-id* is a class type or a reference to a class type, the class
494
  shall be completely-defined.
495
 
496
+ If the type of the expression or *type-id* is a cv-qualified type, the
497
+ result of the `typeid` expression refers to a `std::type_info` object
498
+ representing the cv-unqualified type.
499
 
500
  ``` cpp
501
  class D { /* ... */ };
502
  D d1;
503
  const D d2;
 
532
  virtual base class of `D`. The result has type “*cv2* `D`.” An xvalue of
533
  type “*cv1* `B`” may be cast to type “rvalue reference to *cv2* `D`”
534
  with the same constraints as for an lvalue of type “*cv1* `B`.” If the
535
  object of type “*cv1* `B`” is actually a subobject of an object of type
536
  `D`, the result refers to the enclosing object of type `D`. Otherwise,
537
+ the behavior is undefined.
538
 
539
  ``` cpp
540
  struct B { };
541
  struct D : public B { };
542
  D d;
543
  B &br = d;
544
 
545
  static_cast<D&>(br); // produces lvalue to the original d object
546
  ```
547
 
548
+ A glvalue, class prvalue, or array prvalue of type “*cv1* `T1`” can be
549
+ cast to type “rvalue reference to *cv2* `T2`” if “*cv2* `T2`” is
550
+ reference-compatible with “*cv1* `T1`” ([[dcl.init.ref]]). If the value
551
+ is not a bit-field, the result refers to the object or the specified
552
+ base class subobject thereof; otherwise, the lvalue-to-rvalue
553
+ conversion ([[conv.lval]]) is applied to the bit-field and the
554
+ resulting prvalue is used as the *expression* of the `static_cast` for
555
+ the remainder of this section. If `T2` is an inaccessible (Clause 
556
  [[class.access]]) or ambiguous ([[class.member.lookup]]) base class of
557
  `T1`, a program that necessitates such a cast is ill-formed.
558
 
559
+ An expression `e` can be explicitly converted to a type `T` using a
560
+ `static_cast` of the form `static_cast<T>(e)` if the declaration
561
  `T t(e);` is well-formed, for some invented temporary variable `t` (
562
  [[dcl.init]]). The effect of such an explicit conversion is the same as
563
  performing the declaration and initialization and then using the
564
  temporary variable as the result of the conversion. The expression `e`
565
  is used as a glvalue if and only if the initialization uses it as a
 
599
  restriction that the explicit conversion does not cast away constness (
600
  [[expr.const.cast]]), and the following additional rules for specific
601
  cases:
602
 
603
  A value of a scoped enumeration type ([[dcl.enum]]) can be explicitly
604
+ converted to an integral type. When that type is cv `bool`, the
605
+ resulting value is `false` if the original value is zero and `true` for
606
+ all other values. For the remaining integral types, the value is
607
+ unchanged if the original value can be represented by the specified
608
+ type. Otherwise, the resulting value is unspecified. A value of a scoped
609
+ enumeration type can also be explicitly converted to a floating-point
610
+ type; the result is the same as that of converting from the original
611
+ value to the floating-point type.
612
 
613
  A value of integral or enumeration type can be explicitly converted to
614
  an enumeration type. The value is unchanged if the original value is
615
  within the range of the enumeration values ([[dcl.enum]]). Otherwise,
616
  the resulting value is unspecified (and might not be in that range). A
617
+ value of floating-point type can also be explicitly converted to an
618
+ enumeration type. The resulting value is the same as converting the
619
+ original value to the underlying type of the enumeration (
620
+ [[conv.fpint]]), and subsequently to the enumeration type.
621
 
622
  A prvalue of type “pointer to *cv1* `B`,” where `B` is a class type, can
623
  be converted to a prvalue of type “pointer to *cv2* `D`,” where `D` is a
624
  class derived (Clause  [[class.derived]]) from `B`, if a valid standard
625
  conversion from “pointer to `D`” to “pointer to `B`” exists (
 
628
  `D` nor a base class of a virtual base class of `D`. The null pointer
629
  value ([[conv.ptr]]) is converted to the null pointer value of the
630
  destination type. If the prvalue of type “pointer to *cv1* `B`” points
631
  to a `B` that is actually a subobject of an object of type `D`, the
632
  resulting pointer points to the enclosing object of type `D`. Otherwise,
633
+ the behavior is undefined.
634
 
635
  A prvalue of type “pointer to member of `D` of type *cv1* `T`” can be
636
  converted to a prvalue of type “pointer to member of `B`” of type *cv2*
637
  `T`, where `B` is a base class (Clause  [[class.derived]]) of `D`, if a
638
  valid standard conversion from “pointer to member of `B` of type `T`” to
639
  “pointer to member of `D` of type `T`” exists ([[conv.mem]]), and *cv2*
640
  is the same cv-qualification as, or greater cv-qualification than,
641
+ *cv1*.[^11] The null member pointer value ([[conv.mem]]) is converted
642
  to the null member pointer value of the destination type. If class `B`
643
  contains the original member, or is a base or derived class of the class
644
  containing the original member, the resulting pointer to member points
645
+ to the original member. Otherwise, the behavior is undefined. although
646
+ class `B` need not contain the original member, the dynamic type of the
647
+ object with which indirection through the pointer to member is performed
648
+ must contain the original member; see  [[expr.mptr.oper]].
649
 
650
  A prvalue of type “pointer to *cv1* `void`” can be converted to a
651
  prvalue of type “pointer to *cv2* `T`,” where `T` is an object type and
652
  *cv2* is the same cv-qualification as, or greater cv-qualification than,
653
  *cv1*. The null pointer value is converted to the null pointer value of
654
+ the destination type. If the original pointer value represents the
655
+ address `A` of a byte in memory and `A` satisfies the alignment
656
+ requirement of `T`, then the resulting pointer value represents the same
657
+ address as the original pointer value, that is, `A`. The result of any
658
+ other such pointer conversion is unspecified. A value of type pointer to
659
+ object converted to “pointer to *cv* `void`” and back, possibly with
660
+ different cv-qualification, shall have its original value.
661
 
662
  ``` cpp
663
  T* p1 = new T;
664
  const T* p2 = static_cast<const T*>(static_cast<void*>(p1));
665
  bool b = p1 == p2; // b will have the value true.
 
712
  the original pointer value, the result of such a pointer conversion is
713
  unspecified. see also  [[conv.ptr]] for more details of pointer
714
  conversions.
715
 
716
  An object pointer can be explicitly converted to an object pointer of a
717
+ different type.[^12] When a prvalue `v` of object pointer type is
718
+ converted to the object pointer type “pointer to cv `T`”, the result is
719
+ `static_cast<cv T*>(static_cast<cv void*>(v))`. Converting a prvalue of
720
+ type “pointer to `T1`” to the type “pointer to `T2`” (where `T1` and
721
+ `T2` are object types and where the alignment requirements of `T2` are
722
+ no stricter than those of `T1`) and back to its original type yields the
723
+ original pointer value.
 
 
 
724
 
725
  Converting a function pointer to an object pointer type or vice versa is
726
  conditionally-supported. The meaning of such a conversion is
727
  *implementation-defined*, except that if an implementation supports
728
  conversions in both directions, converting a prvalue of one type to the
 
736
  pointer value.
737
 
738
  A prvalue of type “pointer to member of `X` of type `T1`” can be
739
  explicitly converted to a prvalue of a different type “pointer to member
740
  of `Y` of type `T2`” if `T1` and `T2` are both function types or both
741
+ object types.[^13] The null member pointer value ([[conv.mem]]) is
742
  converted to the null member pointer value of the destination type. The
743
  result of this conversion is unspecified, except in the following cases:
744
 
745
  - converting a prvalue of type “pointer to member function” to a
746
  different pointer to member function type and back to its original
 
749
  `T1`” to the type “pointer to data member of `Y` of type `T2`” (where
750
  the alignment requirements of `T2` are no stricter than those of `T1`)
751
  and back to its original type yields the original pointer to member
752
  value.
753
 
754
+ A glvalue expression of type `T1` can be cast to the type “reference to
755
  `T2`” if an expression of type “pointer to `T1`” can be explicitly
756
+ converted to the type “pointer to `T2`” using a `reinterpret_cast`. The
757
+ result refers to the same object as the source glvalue, but with the
758
+ specified type. That is, for lvalues, a reference cast
759
+ `reinterpret_cast<T&>(x)` has the same effect as the conversion
760
+ `*reinterpret_cast<T*>(&x)` with the built-in `&` and `*` operators (and
761
+ similarly for `reinterpret_cast<T&&>(x)`). No temporary is created, no
762
+ copy is made, and constructors ([[class.ctor]]) or conversion
763
+ functions ([[class.conv]]) are not called.[^14]
 
 
764
 
765
  ### Const cast <a id="expr.const.cast">[[expr.const.cast]]</a>
766
 
767
  The result of the expression `const_cast<T>(v)` is of type `T`. If `T`
768
  is an lvalue reference to object type, the result is an lvalue; if `T`
 
814
  [[conv.mem]]) is converted to the null member pointer value of the
815
  destination type.
816
 
817
  Depending on the type of the object, a write operation through the
818
  pointer, lvalue or pointer to data member resulting from a `const_cast`
819
+ that casts away a const-qualifier[^15] may produce undefined behavior (
820
  [[dcl.type.cv]]).
821
 
822
  The following rules define the process known as *casting away
823
  constness*. In these rules `Tn ` and `Xn ` represent types. For two
824
  pointer types: