Skip to content

Suppress GCC 16's sfinae-incomplete warning#119445

Open
DeeJayLSP wants to merge 1 commit into
godotengine:masterfrom
DeeJayLSP:no-sfinae-incomplete
Open

Suppress GCC 16's sfinae-incomplete warning#119445
DeeJayLSP wants to merge 1 commit into
godotengine:masterfrom
DeeJayLSP:no-sfinae-incomplete

Conversation

@DeeJayLSP
Copy link
Copy Markdown
Contributor

@DeeJayLSP DeeJayLSP commented May 13, 2026

Addresses part of #119269

sfinae-incomplete was introduced in GCC 16, which is meant to catch definitions of types that failed to be complete in an SFINAE context.

At the moment, this happens with the STATIC_ASSERT_INCOMPLETE_TYPE() macro followed by completing that type, which is a context we do want the type to be incomplete, meaning the warning is a false positive.

Note: it has to be done with env.AppendUnique instead of adding to common_warnings as cc1 will spam warnings otherwise.

@DeeJayLSP DeeJayLSP requested a review from a team as a code owner May 13, 2026 22:49
Comment thread SConstruct Outdated
if cc_version_major >= 11:
common_warnings += ["-Wenum-conversion"]
if cc_version_major >= 16:
# Regression in GCC 16, false positives in type-incompleteness assertions, see GH-119269.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's not a regression, it's a new warning which flags a true positive. We just don't consider this to be a something that should be fixed, as we do it on purpose.

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.

Modified the wording to remove "regression" and "false positive".

@DeeJayLSP DeeJayLSP force-pushed the no-sfinae-incomplete branch from c72aca2 to 1ade2b8 Compare May 14, 2026 15:16
Repiteo

This comment was marked as outdated.

@DeeJayLSP
Copy link
Copy Markdown
Contributor Author

(This is assuming that the warning is suppressable during SFINAE. If not, disregard)

Note that the warning is emitted on the class definitions that were checked by the macro, not on the macro itself.

For example:

STATIC_ASSERT_INCOMPLETE_TYPE(class, RenderingServer);
//...
#include "servers/rendering/rendering_server.h" // Warning will be emitted in class RenderingServer : public Object {

@Repiteo
Copy link
Copy Markdown
Contributor

Repiteo commented May 14, 2026

Note: it has to be done with env.AppendUnique instead of adding to common_warnings as cc1 will spam warnings otherwise.

This happens because common_warnings is applied to both C++ and C

@Repiteo Repiteo added bug enhancement cherrypick:4.6 Considered for cherry-picking into a future 4.6.x release and removed discussion labels May 14, 2026
@Repiteo Repiteo modified the milestones: 4.x, 4.7 May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug cherrypick:4.6 Considered for cherry-picking into a future 4.6.x release topic:buildsystem

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants