Title
`vprint_nonunicode_buffered` ignores its `stream` parameter
Status
immediate
Section
[print.fun]
Submitter
Abhinav Agarwal

Created on 2026-03-21.00:00:00 last changed 6 days ago

Messages

Date: 2026-03-24.17:29:18

Proposed resolution:

This wording is relative to N5032.

  1. Modify [print.fun] as indicated:

    void vprint_nonunicode_buffered(FILE* stream, string_view fmt, format_args args);
    

    -14- Effects: Equivalent to:

    string out = vformat(fmt, args);
    vprint_nonunicode(stream, "{}", make_format_args(out));
    
Date: 2026-03-24.00:00:00

[ Croydon 2026-03-24; move to Immediate ]

Date: 2026-03-21.00:00:00

The Effects element of `vprint_nonunicode_buffered(FILE* stream, string_view fmt, format_args args)` in [print.fun] p14 is specified as:

string out = vformat(fmt, args);
vprint_nonunicode("{}", make_format_args(out));

That call selects the two-argument overload `vprint_nonunicode(string_view, format_args)` ([print.fun] p13), whose Effects element delegates to `vprint_nonunicode(stdout, fmt, args)`. The caller-supplied stream is discarded and the output destination becomes `stdout`.

The parallel function `vprint_unicode_buffered` ([print.fun] p8) correctly passes `stream`:

string out = vformat(fmt, args);
vprint_unicode(stream, "{}", make_format_args(out));

This is user-visible: `print(FILE* stream, ...)` ([print.fun] p2) calls `vprint_nonunicode_buffered(stream, ...)` on the non-UTF-8 buffered path, so the current wording routes output to the wrong stream.

History
Date User Action Args
2026-03-24 17:29:18adminsetmessages: + msg16061
2026-03-24 17:29:18adminsetstatus: new -> immediate
2026-03-21 16:56:12adminsetmessages: + msg16040
2026-03-21 00:00:00admincreate