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

fmt::ostream cannot be moved while holding buffered data #2197

Closed
vtta opened this issue Mar 29, 2021 · 1 comment
Closed

fmt::ostream cannot be moved while holding buffered data #2197

vtta opened this issue Mar 29, 2021 · 1 comment

Comments

@vtta
Copy link
Contributor

vtta commented Mar 29, 2021

The following code will throw.
https://godbolt.org/z/58hM1h94e

#include <fmt/os.h>

int main() {
  fmt::ostream out = fmt::output_file("test-file");
  out.print("fail!");
  fmt::ostream moved(std::move(out));
  moved.print("hello");
  return 0;
}
@vtta
Copy link
Contributor Author

vtta commented Mar 29, 2021

related to #1844

vitaut pushed a commit that referenced this issue Mar 30, 2021
…2198)

* Add a test case: move ostream while holding data

* Fix moving ostream while holding data

Co-authored-by: Junliang HU <[email protected]>
@vitaut vitaut closed this as completed Mar 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants