Created on 2025-10-01.00:00:00 last changed 1 month 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]
[ Kona 2025-11-08; Status changed: Immediate → WP. ]
[ Kona 2025-11-05; approved by LWG. Status changed: New → Immediate. ]
[ Kona 2025-11-05; LWG had questions about requiring some cases to be ill-formed. ]
The submitter clarified that it would constrain implementations (effectively requiring `va_start` to be implemented as a magic keyword in the preprocessor, in order to be able to diagnose misuses when preprocessing separately from compilation).
Core approved the new wording.
[ 2025-10-14; Reflector poll ]
Set priority to 1 after reflector poll.
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-11-11 10:48:55 | admin | set | messages: + msg15678 |
| 2025-11-11 10:48:55 | admin | set | status: immediate -> wp |
| 2025-11-06 01:48:06 | admin | set | messages: + msg15539 |
| 2025-11-06 01:48:06 | admin | set | messages: + msg15538 |
| 2025-11-06 01:48:06 | admin | set | status: new -> immediate |
| 2025-10-14 17:45:42 | admin | set | messages: + msg15161 |
| 2025-10-01 10:01:21 | admin | set | messages: + msg15094 |
| 2025-10-01 00:00:00 | admin | create | |