Created on 2025-10-01.00:00:00 last changed 1 week ago
Proposed resolution:
This wording is relative to N5014.
Modify [cstdarg.syn] as indicated:
(1.2) — If more than one argument is present for `va_start` and any of the second or subsequent arguments expands to include unbalanced parentheses, or a preprocessing token that does not convert to a token, the program is ill-formed, no diagnostic required. The preprocessing tokens comprising the second and subsequent arguments to `va_start` (if any) are discarded. [Note 1: `va_start` accepts a second argument for compatibility with prior revisions of C++. — end note]
p3348r4 changed the `va_start` macro to match C23, but the following wording from C is not present in C++:
If any additional arguments expand to include unbalanced parentheses, or a preprocessing token that does not convert to a token, the behavior is undefined.
The importance of that wording was not realized during review of P3348R4. The wording is intended to ensure that any discarded arguments to `va_start` are actually lexable by the compiler, rather than containing unbalanced parentheses or brackets. It also makes the following undefined:
#define BAD ); format_disk(
va_start(ap, BAD);
History | |||
---|---|---|---|
Date | User | Action | Args |
2025-10-01 10:01:21 | admin | set | messages: + msg15094 |
2025-10-01 00:00:00 | admin | create |