Skip to content

Suppress GCC 16 incomplete type warning - #4893

Open
TheNonConformist wants to merge 1 commit into
fmtlib:mainfrom
TheNonConformist:fix-gcc16-sfinae-warning
Open

Suppress GCC 16 incomplete type warning#4893
TheNonConformist wants to merge 1 commit into
fmtlib:mainfrom
TheNonConformist:fix-gcc16-sfinae-warning

Conversation

@TheNonConformist

Copy link
Copy Markdown

GCC 16 emits -Wsfinae-incomplete when the incomplete type used by
incomplete_type_test is later defined.

The pattern is intentional because the test verifies formatting a type while
it is still incomplete. Suppress the GCC 16 diagnostic narrowly around the
definition so the test retains its coverage without producing a warning.

Tested with GCC 16.2.1:

  • Full build succeeded
  • 21/21 tests passed
  • git diff --check passed

@vitaut

vitaut commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Could you post the full warning with context and the repro command (or godbolt link) for future reference?

Comment thread test/format-test.cc Outdated
@TheNonConformist

TheNonConformist commented Aug 24, 2026

Copy link
Copy Markdown
Author

Could you post the full warning with context and the repro command (or godbolt link) for future reference?

Sure. I reproduced it with GCC 16.2.1 using:

cmake -S . -B build -DFMT_TEST=ON -DFMT_DOC=OFF -DFMT_INSTALL=OFF
cmake --build build --target format-test --clean-first --verbose

The complete diagnostic is:

image

@TheNonConformist
TheNonConformist force-pushed the fix-gcc16-sfinae-warning branch from 83d2565 to 20da23c Compare August 24, 2026 04:00
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