Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LWG-3571 flush_emit should set badbit if the emit call fails #2396

Closed
StephanTLavavej opened this issue Dec 11, 2021 · 4 comments · Fixed by #2418
Closed

LWG-3571 flush_emit should set badbit if the emit call fails #2396

StephanTLavavej opened this issue Dec 11, 2021 · 4 comments · Fixed by #2418
Labels
fixed Something works now, yay! LWG Library Working Group issue

Comments

@StephanTLavavej
Copy link
Member

LWG-3571 flush_emit should set badbit if the emit call fails

This was voted into the Working Paper in October 2021, see #2236.

@MattStephanson
Copy link
Contributor

I was going to post this on the PR, but it's more about the issue itself, so I'll put it here.

The LWG resolution makes this an "unformatted output function", so it seems to need a sentry object and everything that goes with it from [ostream.unformatted]/1.

On the other hand, LWG-3570 makes basic_osyncstream::emit itself an unformatted output function, so constructing a sentry both here and in the emit call seems redundant. Both issues use the typical "After constructing a sentry object..." wording, which I read as requiring two separate sentry objects, unless there's an argument that the as-if rule applies.

@MattStephanson
Copy link
Contributor

FYI, @fsb4000.

@fsb4000
Copy link
Contributor

fsb4000 commented Dec 15, 2021

Thank you @MattStephanson ! I completely missed this sentence when doing the implementation.

But I think both sentry objects are needed because one sentry object is created in basic_osyncstream::emit but flush_emit calls _Basic_syncbuf_impl::emit

@MattStephanson
Copy link
Contributor

But I think both sentry objects are needed because one sentry object is created in basic_osyncstream::emit but flush_emit calls _Basic_syncbuf_impl::emit

@fsb4000 I think you're right, I was confusing basic_osyncstream::emit (which is an unformatted output function) with basic_syncbuf::emit (which isn't). flush_emit calls the latter, so there's no issue of duplicate sentry objects.

@StephanTLavavej StephanTLavavej added the fixed Something works now, yay! label Mar 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed Something works now, yay! LWG Library Working Group issue
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants