C++ Logo

liaison

Advanced search

Re: [wg14/wg21 liaison] [isocpp-sg21] Telecon to review P2388R1 Minimum Contract Support: either Ignore or Check_and_abort

From: Aaron Ballman <aaron_at_[hidden]>
Date: Fri, 24 Sep 2021 11:36:57 -0400
On Fri, Sep 24, 2021 at 11:24 AM Gabriel Dos Reis <gdr_at_[hidden]> wrote:
>
> [Jens]
> > I don't agree. Something like "[[gnu::fastcall]]" seems very much attached
> > to the function type. In particular, a type mismatch in a function call
> > with respect to that attribute is likely going to cause a crash.
>
> However, that is notion is completely outside the standards. The standards don't even acknowledge that you can have a new function type by adding a calling convention, nor they even say that you can add an attribute to construct such a type. The whole notion of "appertaining to a function type" is left undefined.

Existing implementation practice uses this feature to form new types.
The standard doesn't need to define what that means until we get a
standards-based type attribute because this is wholly in the realm of
the implementation-defined nature of vendor specific attributes. But
the key point I was making was -- there is existing implementation
practice of using function type attributes in the wild, so users have
a degree of experience with what [[]] means after the parameter list,
and the proposed contracts syntax does not behave in the same way.

> Can you overload on it? Can you template-argument deduce it? How do they behave with respect to std::same_as?

Yes, these are all questions one has to answer on a per-attribute basis.

~Aaron

Received on 2021-09-24 10:37:17