Skip to content

Give useful error when misusing fmt::ptr.#4453

Merged
vitaut merged 1 commit intofmtlib:masterfrom
TobiSchluter:bugfix/missing_message
May 20, 2025
Merged

Give useful error when misusing fmt::ptr.#4453
vitaut merged 1 commit intofmtlib:masterfrom
TobiSchluter:bugfix/missing_message

Conversation

@TobiSchluter
Copy link
Copy Markdown
Contributor

static_assert(bla, "") prints an empty message but not the condition with MSVC. Add an informative message.

E.g.
int i; fmt::print("{}", fmt::ptr(i))
will print the empty message from the static_assert and the code location, but not the static_assert's condition. This patch makes it print a useful message.

I audited all static_asserts, and this appears to be the only user-facing static_assert that didn't contain a message.

static_assert(bla, "") prints an empty message but not the condition with at least MSVC. Add an informative message.
@vitaut vitaut merged commit b723c02 into fmtlib:master May 20, 2025
45 checks passed
@vitaut
Copy link
Copy Markdown
Contributor

vitaut commented May 20, 2025

Merged, thanks

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.

2 participants