A cv-decomposition of a type T
is a sequence of
and
such that T is
“ ⋯U” for ,
where
each is a set of cv-qualifiers ([basic.type.qualifier]), and
each is
“pointer to” ([dcl.ptr]),
“pointer to member of class of type” ([dcl.mptr]),
“array of ”, or
“array of unknown bound of” ([dcl.array]).
If designates an array,
the cv-qualifiers on the element type are also taken as
the cv-qualifiers of the array.
Two types and are similar if
they have cv-decompositions with the same n
such that corresponding components are the same
and the types denoted by U are the same.
A prvalue expression of type
can be converted to type
if the following conditions are satisfied,
where denotes the cv-qualifiers in the cv-qualification signature of :60
If a program could assign a pointer of type T** to a pointer of
type constT** (that is, if line #1 below were
allowed), a program could inadvertently modify a const object
(as it is done on line #2).
For example,
int main() {
const char c = 'c';
char* pc;
const char** pcc = &pc; // #1: not allowed
*pcc = &c;
*pc = 'C'; // #2: modifies a const object
}
A prvalue of type “pointer to cv1T” can be
converted to a prvalue of type “pointer to cv2T” if
“cv2T” is more cv-qualified than “cv1T”.
A prvalue of type “pointer to member of X of type cv1T” can be converted to a prvalue of type “pointer to member
of X of type cv2T” if “cv2T” is more cv-qualified than “cv1T”.