C++ Logo

std-discussion

Advanced search

Re: Type requirements for va_start

From: Janet Cobb <janet_at_[hidden]>
Date: Thu, 8 Jun 2023 15:49:21 -0400
On 6/5/23 21:35, Brian Bi via Std-Discussion wrote:
>
>
> On Tue, Apr 25, 2023 at 5:34 PM Edward Catmur via Std-Discussion
> <std-discussion_at_[hidden]> wrote:
>
>
>
> On Tue, 25 Apr 2023 at 14:39, Thiago Macieira via Std-Discussion
> <std-discussion_at_[hidden]> wrote:
>
> On Tuesday, 25 April 2023 11:53:46 PDT Lukas Barth via
> Std-Discussion wrote:
> > At this point I'm at my wit's end. How is that rule to be
> interpreted?
>
> Why are you trying to interpret it? Can't you just assume that
> if the type
> isn't a trivial scalar, it can't be passed?
>
>
> An enum is a trivial scalar.
>
> > Could it be that this use of "compatible" in `[stdarg.syn]/1.2` was
> grandfathered in from C, but is not defined anymore?
>
> Yes.
>
>
> It seems that we need to open an LWG issue about this. "Compatible" is
> indeed not defined and we cannot simply assume that it means what it
> means in the C standard, because not every C++ type is a valid C type,
> meaning that it would not be clear how to apply the definition from C.


The damage is limited by https://eel.is/c++draft/expr.call#11.sentence-7 :

> Passing a potentially-evaluated argument of a scoped enumeration type
> or of a class type ([class] <https://eel.is/c++draft/class>) having an
> eligible non-trivial copy constructor, an eligible non-trivial move
> constructor, or a non-trivial destructor ([special]
> <https://eel.is/c++draft/special>), with no corresponding parameter,
> is conditionally-supported with implementation-defined semantics.

-- 
Janet Cobb

Received on 2023-06-08 19:49:23