New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[class.spaceship]/3 operation order is unclear #2748
Comments
"comparing [...] in the [...] list [...] until the first index [...]" seems pretty clear to me that the intent is that you walk the elements of the list in the order in which they appear in the list. That said, I do agree that it's possible to read this as pulling indices from an unspecified set of indices in an unspecified order. Adding an "(in increasing index order)" or similar seems sufficiently far into "clarification of obvious intent" category that I think I'd be comfortable adding that editorially. Would that satisfy your concern? (Note that due to /1's "It is unspecified whether virtual base class subobjects are compared more than once.", we don't actually want to say that each index is considered exactly once.) |
Yes, that was my suggestion in #2729 (comment) - Jens wanted you to approve that such a clarification would be editorial.
The implication of the "list of subobjects" wording is that virtual base class subobjects may appear more than once in the list of subobjects. If that is the case each appearance would have a distinct index, so considering each index only once would not contradict that sentence. |
That's not actually the case we care about, and it's not possible, because only direct base classes are in the list, and a virtual base class can be a direct base class at most once.
The problem is not that we'd be restricted to consider each index at most once, the problem is that we'd be restricted to consider each index at least once. Consider:
The expanded list of subobjects for C is exactly [A, n]. But when we compare the C subobject of D, we might want to skip the first index in the list, because we already compared the A subobject when comparing the B subobject of D. |
The subject paragraph:
is clear that corresponding elements are compared, and that the process of comparison must terminate, but specifies neither the order in which indices within the list of subobjects are chosen nor that said sequence of chosen indices contains no duplicates. It's almost certainly the intent that corresponding pairs of elements are compared in order of increasing subscript, but that doesn't seem to be mandated.
#2729 adds similar wording elsewhere with the same issue. Could we clarify these editorially, or does this need a core issue?
The text was updated successfully, but these errors were encountered: