Date: Thu, 21 Nov 2024 23:46:36 +0100
On Thu, Nov 21, 2024 at 11:43 PM Brian Bi <bbi5291_at_[hidden]> wrote:
> I totally agree on the connection of the words "declared return type"
>> with the conversion-function-id.
>> That's why I originally expressed that type-specifier-seq already
>> includes
>> the case of conversion-function-id.
>>
>
> I'm not sure what your remaining question is, then. Can you give an
> example?
>
>
>>
>> About p2, thank you to highlight its context.
>> However, I wonder two details, that likely biased my attention in missing
>> to focus on the correct context:
>>
>> a) how a trailing-return-type may be persent in one of those context ?
>> Currently, I interpret "The type of a parameter-declaration of" (one
>> of three cases),
>> because all three cases include parameter-declaration clause in their
>> syntax,
>> but another possible interpretation might be "The type of" (one of
>> the three cases),
>> that is, applying parameter declaration only to the function
>> declaration.
>> Do you believe the text may be clarified to avoid such ambiguity ?
>>
>
> Well, the alternative interpretation is absurd, because you don't get to
> declare the type of a lambda. But, ideally, it should be possible to parse
> the sentence without needing semantic knowledge about C++, so, yes, I think
> this should be clarified. I think this would be an editorial-level change,
> so please submit an issue here: https://github.com/cplusplus/draft/issues
> And attach a pull request, if you can.
>
>
>> Does it affect the way a trailing-return-type may be in place ?
>>
>
> I'm not understanding the question.
>
>
>>
>> b) do you believe that the words 'see below' in the p2 statement
>> "... in a trailing-return-type that specifies the type that replaces
>> such a decl-specifier (see below)"
>> are still applicable ?
>> The only interpretation I see for them is about type replacement,
>> which is already well discussed in [dcl.fct]-p(1.3)
>> In the old text of C++20, there was a p3 (corresponding to
>> p3 and p4 of the current new draft) that read
>> "... that trailing-return-type specifies the declared return type of
>> the function."
>> which was redundant compared to [dcl.fct]-p(1.3).
>> Should the redundancy be removed also in p2 about the words 'see
>> below' ?
>> Is it possible that 'see below' refers §9.3.4.6 [dcl.fct]
>> from §9.2.9.7.1 [decl.spec.auto.general] ? A reference may be better ?
>>
>>
> The "see below" in p2 refers to p3. To understand what it means, notice
> that we have the same language in p5, except without "see below" since it's
> not a forward reference from p5. We have this example:
>
> auto (*fp)() -> auto = f; // OK
>
> The second `auto` is in "the trailing-return-type that specifies the type
> that replaces" the first `auto`.
>
> You can have this in a parameter declaration too:
>
Oops, sent the message too early by accident. Here's an example:
constexpr auto l = [](auto (*fp)() -> auto) { return fp; };
int foo();
static_assert(l(foo) == foo);
Note that GCC currently ICEs on this example, but Clang and MSVC are ok
with it.
>
>
>
>>
>> will also wait for a comment on the original third point:
>> trailing return type -> trailing-return-type
>> in [class.conv.fct]-p3
>>
>
My preference is to change the comments to say "trailing return type" since
they're referring to the use of the feature, not the fact that the grammar
production is present (although, of course, it doesn't make a difference,
since the two situations are the same). But, that's just my opinion.
>
>>
>> as well as about the topic in
>>
>> https://stackoverflow.com/questions/79208177/multiple-occurrences-of-placeholder-type-auto-in-a-type
>> related to [dcl.type.auto.deduct]-p3.
>>
>
>
> --
> *Brian Bi*
>
> I totally agree on the connection of the words "declared return type"
>> with the conversion-function-id.
>> That's why I originally expressed that type-specifier-seq already
>> includes
>> the case of conversion-function-id.
>>
>
> I'm not sure what your remaining question is, then. Can you give an
> example?
>
>
>>
>> About p2, thank you to highlight its context.
>> However, I wonder two details, that likely biased my attention in missing
>> to focus on the correct context:
>>
>> a) how a trailing-return-type may be persent in one of those context ?
>> Currently, I interpret "The type of a parameter-declaration of" (one
>> of three cases),
>> because all three cases include parameter-declaration clause in their
>> syntax,
>> but another possible interpretation might be "The type of" (one of
>> the three cases),
>> that is, applying parameter declaration only to the function
>> declaration.
>> Do you believe the text may be clarified to avoid such ambiguity ?
>>
>
> Well, the alternative interpretation is absurd, because you don't get to
> declare the type of a lambda. But, ideally, it should be possible to parse
> the sentence without needing semantic knowledge about C++, so, yes, I think
> this should be clarified. I think this would be an editorial-level change,
> so please submit an issue here: https://github.com/cplusplus/draft/issues
> And attach a pull request, if you can.
>
>
>> Does it affect the way a trailing-return-type may be in place ?
>>
>
> I'm not understanding the question.
>
>
>>
>> b) do you believe that the words 'see below' in the p2 statement
>> "... in a trailing-return-type that specifies the type that replaces
>> such a decl-specifier (see below)"
>> are still applicable ?
>> The only interpretation I see for them is about type replacement,
>> which is already well discussed in [dcl.fct]-p(1.3)
>> In the old text of C++20, there was a p3 (corresponding to
>> p3 and p4 of the current new draft) that read
>> "... that trailing-return-type specifies the declared return type of
>> the function."
>> which was redundant compared to [dcl.fct]-p(1.3).
>> Should the redundancy be removed also in p2 about the words 'see
>> below' ?
>> Is it possible that 'see below' refers §9.3.4.6 [dcl.fct]
>> from §9.2.9.7.1 [decl.spec.auto.general] ? A reference may be better ?
>>
>>
> The "see below" in p2 refers to p3. To understand what it means, notice
> that we have the same language in p5, except without "see below" since it's
> not a forward reference from p5. We have this example:
>
> auto (*fp)() -> auto = f; // OK
>
> The second `auto` is in "the trailing-return-type that specifies the type
> that replaces" the first `auto`.
>
> You can have this in a parameter declaration too:
>
Oops, sent the message too early by accident. Here's an example:
constexpr auto l = [](auto (*fp)() -> auto) { return fp; };
int foo();
static_assert(l(foo) == foo);
Note that GCC currently ICEs on this example, but Clang and MSVC are ok
with it.
>
>
>
>>
>> will also wait for a comment on the original third point:
>> trailing return type -> trailing-return-type
>> in [class.conv.fct]-p3
>>
>
My preference is to change the comments to say "trailing return type" since
they're referring to the use of the feature, not the fact that the grammar
production is present (although, of course, it doesn't make a difference,
since the two situations are the same). But, that's just my opinion.
>
>>
>> as well as about the topic in
>>
>> https://stackoverflow.com/questions/79208177/multiple-occurrences-of-placeholder-type-auto-in-a-type
>> related to [dcl.type.auto.deduct]-p3.
>>
>
>
> --
> *Brian Bi*
>
-- *Brian Bi*
Received on 2024-11-21 22:46:49