C++ Logo

std-discussion

Advanced search

Re: placeholder type in trailing return type

From: mauro russo <ing.russomauro_at_[hidden]>
Date: Thu, 21 Nov 2024 10:50:41 +0100
>> About second point, my bad, I meant p2, sorry for having written p1.

> This paragraph only discusses uses of placeholders that are used to
> declare the type of a parameter or template parameter.
> The text "The placeholder type shall appear as [...] or [...]"
> applies only in those contexts.

> The conversion function case is covered by [dcl.spec.auto.general]/4.
> You can't have a trailing return type for a conversion function,
> so "type-specifier-seq" in this paragraph refers to the
*type-specifier-seq*
> in *conversion-type-id* ([class.conv.fct]). Notice that
[class.conv.fct]/2 says
> that "its declared return type is the *conversion-type-id*", which links
it
> to [dcl.spec.auto.general]/4 where we also talk about "declared return
type".

Yes, Brian, thank you for the confirmation,
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.

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 ?
    Does it affect the way a trailing-return-type may be in place ?

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 ?


will also wait for a comment on the original third point:
trailing return type -> trailing-return-type
in [class.conv.fct]-p3


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.

Received on 2024-11-21 09:50:55