[concepts.callable.general, concept.invocable] add function types and references#8402
[concepts.callable.general, concept.invocable] add function types and references#8402morinmorin wants to merge 1 commit into
Conversation
|
Did you consider extending the definition of "callable types" to include function references as well? My intuition for the status quo is that a "callable type" is anything that can be thrown into What you're proposing doesn't seem compelling from a wording cost/benefit perspective because it's all intro fluff wording anyway. We don't need to be super precise there. |
|
Instead, I think it would make more sense to modify [func.def] as
And p4 doesn't need to be modified because there's no object of a function or reference type. |
|
Thank you both for your insightful feedback! When I first read the wording on "18.7 callable concepts", I assumed that callable types included function types as well. After re-reading, it appears that's not the case, so I've opened an issue. Including function types in callable type would be a non-editorial change, so we could take this to LWG as an issue. I'll close this PR. |
|
As an aside, I'd like to note a related thought about function types and the callable concepts, specifically Imagine a hypothetical world where a compiler could magically check the semantic requirements of In that world, |
|
https://eel.is/c++draft/res.on.requirements#2 The program would be IFNDR if you used The specification isn't clear on that, but these semantic requirements are situational. My understanding is that e.g. it is well-formed to use In short, the "satisfies" part of |
Perhaps we should say "well-defined" instead of "well-formed" as there shouldn't be dynamically determined well-formedness. In this case, semantic requirements for modeling should be transformed into preconditions of the function. But it's quite unclear how to transform them. |
This is a follow-up to PR #8255 (and fixes Issue #8241).
In [concepts.callable.general] and [concept.invocable], it would be more appropriate to use "function types, callable types, and references to such types" instead of "callable types".