C++ Logo

std-discussion

Advanced search

Re: Type requirements for va_start

From: Lukas Barth <cpp_at_[hidden]>
Date: Thu, 08 Jun 2023 22:37:41 +0200
Hi Brian,

On Mon, 2023-06-05 at 21:35 -0400, Brian Bi via Std-Discussion wrote:
> Lukas, please email lwgchair_at_[hidden] to submit an LWG issue. If you
> don't have time to do it, I can do it for you.

I just sent this mail to the LWG chairs:

=========================================
As recommended on the std-discussion list (Thread 'Type requirements
for va_start'), I would like to report an issue with the current C++
standard.

Suggested Title: 'Compatible types' are undefined in [cstdarg.syn]/1.2

Description:

Section [cstdarg.syn]/1.2 states (among other things): "… If the
parameter parmN is of a reference type, or of a type that is not
compatible with the type that results when passing an argument for
which there is no parameter, the behavior is undefined."

Unlike the C standard, the C++ standard has no notion of 'compatible
types', thus the meaning of this sentence unclear.


Solution:

I am unsure how to properly state the requirements for the types that
can be passed to va_args. I think I understood that the idea is that
only types that could be passed in the ellipsis would be allowed as
second parameter to va_start, but I'm not sure whether that is in fact
correct. If it is correct, I think that the rules in [expr.call]/11,
which state what types can be passed in the ellipsis, also determine
the types that can be used for the second parameter. Maybe the standard
should just refer to [expr.call]/11 in [cstdarg.syn]/1.2.
=========================================

As you might notice, I'm especially unsure about the solution part. ;-)
If there are any suggestions on how to properly formulate the rule, I'd
gladly take them.

All the best,
Lukas

Received on 2023-06-08 20:38:20