[expr.const.cast] p3 states
For two similar types T1 and T2, a prvalue of type T1 may be explicitly converted to the type T2 using a const_cast if, considering the qualification-decompositions of both types, each P1i is the same as P2 i for all i. The result of a const_cast refers to the original entity.
Presumably, the requirement in this rule should impose on any case that uses the const_cast casting. Even though the conversion would be a standard qualification conversion, it is not supported
typedef int CK[][2]; int main(){ int arr[2][2]; CK& rf0 = arr; // ok, qualification conversion CK& rf = const_cast<CK&>(arr); // ill-formed, the requirement is not satisfied }
Change [expr.const.cast] p3 to
For any casting from an expression of type
T1
to typeT2
using a const_cast, considering the qualification-decompositions of both types, each P1i shall be the same as P2 i for all i. The result of a const_cast refers to the original entity.
The rules defined in the subsequence paragraphs that use const_cast
casting all should satisfy this precondition.
Another issue appears in [expr.const.cast] p7: U1
suddenly appears without any introduction. Maybe, change it to
A conversion from a type T1 to a type T2 casts away constness if T1 and T2 are different, there is a qualification-decomposition ([conv.qual]) of T1
cv10 P10 cv11 P11 ... cv1n-1 P1n-1 cv1n U1
yielding n such that T2 has a qualification-decomposition of the form
cv20 P20 cv21 P21 ... cv2n-1 P2n-1 cv2n U2
and there is no qualification conversion that converts T1 to
cv20 P10 cv21 P11 ... cv2n-1 P1n-1 cv2n U1
would be more clear.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4