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
[dcl.type.auto.deduct] Use "immediately-declared constraint of" #2477
Comments
I'm reading the "immediately-declared constraint" construction in clause 12 p6 as syntactic; we often talk about "type" in the syntax analysis when we also mean "placeholder-type-specifier". So, clause 12 tells us what the immediately-declared constraints of the placeholder-type-specifier are, "its" in the quote above obviously refers to the placeholder, and the normative text says that whatever we deduce for the placeholder has to then satisfy the constraint. The proposed new wording sounds as if we're defining "immediately-declared constraint" for a placeholder-type-specifier, in addition to the "of a type" in clause 12. That seems suboptimal. [temp.param] p10 supports the "syntactic" interpretation by talking about the "invented type" corresponding to the placeholder. (After the placeholder is deduced, there is a real type, not an invented one.) |
The immediately-declared constraint of any type uses that type in the constraint-expression. Clause 12 defines what the immediately-declared constraint of a type is only when given a type by other wording elsewhere. The proposed wording specifies that in auto-type deduction contexts, the type to plug in is the type deduced for the placeholder. As for [temp.param] p10, it does not talk about the deduced type; the "invented type" is the notional dependent type that is still to be deduced. |
Regarding [temp.param] p10, the text reads "introduces the immediately-declared constraint of the invented type corresponding to the placeholder." So, we're still talking about what I call the syntactic level: it's the notional type "auto" that gets an immediately-declared constraint. |
The definition of an "immediately-declared constraint" does not "give" anything to a type, so nothing "gets an immediately-declared constraint" in [temp.param] p10. The immediately-declared constraint is an expression; the application of the expression is determined by the text elsewhere. The operative word in [temp.param] p10 is "introduces". The [decl.type.auto.deduct] wording applies the constraint-expression by requiring it to be satisfied--it does not redefine the term "immediately-declared constraint". For me, the difference between the two cases is that the [temp.param] case does attach constraints prior to instantiation (relevant for partial ordering), and the [dcl.type.auto.deduct] case does not. template <typename T> concept C = true;
template <auto x, typename U> struct A { };
template <C T, T x, C U> struct A<x, U> { struct Happy; };
template <C auto x, typename U> struct A<x, U> { };
typename A<0, int>::Happy *p = 0; // okay We only apply the constraint after the deduction in [dcl.type.auto.deduct], so I see not issue with asking for the constraint-expression written in terms of the deduced type. The immediately-declared constraint of a type |
Editorial meeting:
|
Example: The defining sentence will become:
|
draft/source/declarations.tex
Lines 1894 to 1897 in 65a4bac
This is an instance where the antecedent of "its" is not entirely clear on first reading in relation to "immediately-declared constraint", which is a new term. An immediately-declared constraint is always one "of" a type; therefore, we are talking about the immediately-declared constraint of the type deduced for the placeholder.
Suggested wording:
The text was updated successfully, but these errors were encountered: