Skip to content

Fix C++20 concept detection#4653

Merged
vitaut merged 1 commit intofmtlib:masterfrom
tearfur:ISO-19217
Jan 16, 2026
Merged

Fix C++20 concept detection#4653
vitaut merged 1 commit intofmtlib:masterfrom
tearfur:ISO-19217

Conversation

@tearfur
Copy link
Copy Markdown
Contributor

@tearfur tearfur commented Jan 15, 2026

Fix compilation on GCC < 8.4 with -fconcepts.

From GCC 8.4 onwards, ISO-19217 concepts -fconcepts are compatible with C++20 concepts thanks to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88075. Edit: Irrelevant

Repro of what I'm trying to fix: https://godbolt.org/z/vv179vWGe

Copy link
Copy Markdown
Contributor

@vitaut vitaut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR but I think we should only support C++20 concepts.

Comment thread include/fmt/base.h Outdated
@@ -2805,7 +2814,7 @@ using is_formattable = bool_constant<!std::is_same<
void>::value>;
#ifdef __cpp_concepts
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To elaborate: we should only check __cpp_concepts >= 201907L here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

13c1cbc Updated.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

9ab39ba Updated again to fix -Wundef warning.

@tearfur tearfur changed the title Support ISO 19217 concepts Fix C++20 concept detection Jan 16, 2026
@vitaut vitaut merged commit a9ea225 into fmtlib:master Jan 16, 2026
80 of 89 checks passed
@vitaut
Copy link
Copy Markdown
Contributor

vitaut commented Jan 16, 2026

Merged, thanks for the fix!

@tearfur tearfur deleted the ISO-19217 branch January 16, 2026 19:13
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