"similar" applied to non-pointer-like types

19 views
Skip to first unread message

T. C.

unread,
Sep 8, 2016, 3:35:11 PM9/8/16
to ISO C++ Standard - Discussion
Various parts of the standard seems to be using the term "similar" as defined in [conv.qual] as if it applies to all object types (e.g., [ptr.launder]/1: "Requires: p represents the address A of a byte in memory. An object X that is within its lifetime ([basic.life]) and whose type is similar ([conv.qual]) to T is located at the address A. ").

But [conv.qual]/1 defines the cv-decomposition of a type to be "cv0 P0 cv1 P1  cvn-1 Pn-1 cvn U" where n > 0, i.e., there is at least one P. So it's only defined for multilevel mixed pointers/arrays.

And then [conv.qual]/2 says "Two types T1 and T2 are similar if they have cv-decompositions with the same n such that corresponding Pi components are the same and the types denoted by U are the same", which appears to require both types at issue to have cv-decompositions in the first place - or, in other words, that both are multilevel mixed pointers/arrays.

Did I miss something?
Reply all
Reply to author
Forward
0 new messages