From Jason Turner

[dcl.type.cv]

Diff to HTML by rtfpessoa

tmp/tmpa4_iy_ee/{from.md → to.md} RENAMED
@@ -27,23 +27,24 @@ the object referenced is a non-const object and can be modified through
27
  some other access path.
28
 
29
  [*Note 4*: Cv-qualifiers are supported by the type system so that they
30
  cannot be subverted without casting [[expr.const.cast]]. — *end note*]
31
 
32
- Any attempt to modify ([[expr.ass]], [[expr.post.incr]],
33
- [[expr.pre.incr]]) a const object [[basic.type.qualifier]] during its
34
- lifetime [[basic.life]] results in undefined behavior.
 
35
 
36
  [*Example 1*:
37
 
38
  ``` cpp
39
  const int ci = 3; // cv-qualified (initialized as required)
40
  ci = 4; // error: attempt to modify const
41
 
42
  int i = 2; // not cv-qualified
43
  const int* cip; // pointer to const int
44
- cip = &i; // OK: cv-qualified access path to unqualified
45
  *cip = 4; // error: attempt to modify through ptr to const
46
 
47
  int* ip;
48
  ip = const_cast<int*>(cip); // cast needed to convert const int* to int*
49
  *ip = 4; // defined: *ip points to i, a non-const object
 
27
  some other access path.
28
 
29
  [*Note 4*: Cv-qualifiers are supported by the type system so that they
30
  cannot be subverted without casting [[expr.const.cast]]. — *end note*]
31
 
32
+ Any attempt to modify
33
+ [[expr.ass]], [[expr.post.incr]], [[expr.pre.incr]] a const object
34
+ [[basic.type.qualifier]] during its lifetime [[basic.life]] results in
35
+ undefined behavior.
36
 
37
  [*Example 1*:
38
 
39
  ``` cpp
40
  const int ci = 3; // cv-qualified (initialized as required)
41
  ci = 4; // error: attempt to modify const
42
 
43
  int i = 2; // not cv-qualified
44
  const int* cip; // pointer to const int
45
+ cip = &i; // OK, cv-qualified access path to unqualified
46
  *cip = 4; // error: attempt to modify through ptr to const
47
 
48
  int* ip;
49
  ip = const_cast<int*>(cip); // cast needed to convert const int* to int*
50
  *ip = 4; // defined: *ip points to i, a non-const object