Skip to content

Fix field width handling in enum stream output - #480

Open
davidscottpope-gif wants to merge 7 commits into
Neargye:masterfrom
davidscottpope-gif:fix/enum-ostream-field-width
Open

davidscottpope-gif wants to merge 7 commits into
Neargye:masterfrom
davidscottpope-gif:fix/enum-ostream-field-width

Conversation

@davidscottpope-gif

Copy link
Copy Markdown

The width bug lives in the two named-value loops in magic_enum_iostream.hpp; optional output, the iostream alias and the module export inherit it. Insert each name as one formatted string field so width applies and resets, as merged #479 already does for bitset.

We also tried a sentry-aware mixed-character writer, but its hand-written streambuf handling diverged on libc++, swallowed forced unwind and leaked tied-stream exceptions, so this patch delegates to native string insertion. Mixed-character output can allocate before the sentry check; same-character output uses string_view without a conversion allocation.

Tests cover width/alignment/fill, flags, optional values, wide/custom-Traits/alias output, short writes, exceptions, ties and unitbuf. AI-assisted investigation and reproduction.

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

Successfully merging this pull request may close these issues.

1 participant