Skip to content

Suppress C++23 float_denorm_style deprecation warning in numeric_limits<half>#546

Merged
cary-ilm merged 2 commits intoAcademySoftwareFoundation:mainfrom
cary-ilm:float_denorm_style-warning
Apr 17, 2026
Merged

Suppress C++23 float_denorm_style deprecation warning in numeric_limits<half>#546
cary-ilm merged 2 commits intoAcademySoftwareFoundation:mainfrom
cary-ilm:float_denorm_style-warning

Conversation

@cary-ilm
Copy link
Copy Markdown
Member

@cary-ilm cary-ilm commented Mar 1, 2026

Part of an effort to get CI building without warnings.

C++23 deprecates std::float_denorm_style and std::denorm_present but does not remove them or provide a replacement; std::numeric_limits still requires has_denorm to be of that type, so we must use it, which leads to a warning:

  src/Imath/half.h:948:22: warning: 'float_denorm_style' is deprecated [-Wdeprecated-declarations]
      static constexpr float_denorm_style has_denorm        = denorm_present;
                       ^

Suppress the warning for this use and only when building in C++23 (or later): wrap the has_denorm declaration in compiler-specific pragmas (GCC/Clang -Wdeprecated-declarations, MSVC 4996) guarded by (__cplusplus >= 202302L) and the compiler macro. Pre-C++23 builds are unchanged and use no pragmas.

Made-with: Cursor

…ts<half>

Part of an effort to get CI building without warnings.

C++23 deprecates std::float_denorm_style and std::denorm_present
but does not remove them or provide a replacement; std::numeric_limits
still requires has_denorm to be of that type, so we must use it, which leads to a warning:

  src/Imath/half.h:948:22: warning: 'float_denorm_style' is deprecated [-Wdeprecated-declarations]
      static constexpr float_denorm_style has_denorm        = denorm_present;
                       ^

Suppress the warning for this use and only when building in C++23 (or
later): wrap the has_denorm declaration in compiler-specific pragmas
(GCC/Clang -Wdeprecated-declarations, MSVC 4996) guarded by
(__cplusplus >= 202302L) and the compiler macro. Pre-C++23 builds are
unchanged and use no pragmas.

Made-with: Cursor
Signed-off-by: Cary Phillips <cary@ilm.com>
@cary-ilm cary-ilm merged commit 11ca35a into AcademySoftwareFoundation:main Apr 17, 2026
34 checks passed
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