Skip to content
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

[cmp.alg] Notes for ill-formed cases are inconsistent with those in [range.access] #4492

Closed
frederick-vs-ja opened this issue Feb 10, 2021 · 4 comments · Fixed by #4494
Closed
Assignees

Comments

@frederick-vs-ja
Copy link
Contributor

It's noted that "This case can result in substitution failure when *_­order(E, F) appears in the immediate context of a template instantiation." in [cmp.alg], which implies that only one of the two ill-formed cases results in substitution failure. And such notes don't exist in specifications of compare_*_order_fallback CPOs.

Are the cases for hard error overriding [customization.point.object]/4 are intended?

If not, I think that we should also use the form "(Diagnosable) ill-formed cases above result in substitution failure when *(E, F) appears in the immediate context of a template instantiation" (from [range.access]) in [cmp.alg] and apply the notes for all six CPOs.

By the way, the uses of std:: are also inconsistent in these notes currently.

@jensmaurer
Copy link
Member

So, the suggestion is to replace the notes in [cmp.alg] about immediate context with the phrasing from [ranges.access]: "Ill-formed cases above result in substitution failure when strong_order(E) appears in the immediate context of a template instantiation." so that the note covers both ill-formed cases, not just the last one.

Also, it feels that "performed in a context that does not include a declaration of" should be replaced by the more precise "performed in a context in which unqualified lookup for strong_order finds nothing".

@jwakely, are these changes (in particular the first one) net improvements, and sufficiently editorial?

@jwakely
Copy link
Member

jwakely commented Feb 11, 2021

which implies that only one of the two ill-formed cases results in substitution failure.

It might imply it, but it's not normative, so I don't think the presence or absence of such notes can override anything normative. But I'm not sure whether [customization.point.object] p4 applies to the first bullet; is "If the decayed types of E and F differ, strong_­order(E, F) is ill-formed." a "requirement specified in the customization point's definition"? It's not stated as a requirement.

When I implemented std::strong_order I used a static_assert to check the decayed types are the same, which means it doesn't result in substitution failure. I'd like to hear from @brevzin whether the intention is that all the ill-formed cases in [cmp.alg] are supposed to result in substitution failures rather than hard errors.

@brevzin
Copy link
Contributor

brevzin commented Feb 11, 2021

@jwakely the intent was that all the ill-formed cases result in substitution failure, yeah.

@jwakely
Copy link
Member

jwakely commented Feb 11, 2021

Thanks, Barry. Then I like the suggestion. It's clarifying the original intent, so I'm happy for it to be done editorially.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants