Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning because stdfloat is included with C++17 #1023

Closed
ChristophStrehle opened this issue Aug 28, 2023 · 6 comments · Fixed by #1024
Closed

Warning because stdfloat is included with C++17 #1023

ChristophStrehle opened this issue Aug 28, 2023 · 6 comments · Fixed by #1024

Comments

@ChristophStrehle
Copy link

ChristophStrehle commented Aug 28, 2023

When I include boost/math/concepts/real_concept.hpp or boost/math/tools/promotion.hpp from boost 1.83 I get the following compiler warning with Visual Studio 17.7 and the v143 version 14.37 toolset compiling for C++17:

warning STL4038: The contents of <stdfloat> are available only with C++23 or later.

Looks like stdfload is there but should not be included with C++17. The two includes are here:
https://github.com/boostorg/math/blob/develop/include/boost/math/tools/promotion.hpp#L31
https://github.com/boostorg/math/blob/develop/include/boost/math/concepts/real_concept.hpp#L49

Btw I don't get this warning when I include boost/math/tools/config.hpp:
https://github.com/boostorg/math/blob/develop/include/boost/math/tools/config.hpp#L157

@jzmaddock
Copy link
Collaborator

That's a bug, tools/config.hpp is doing it correctly (checking the std version first).

I should add some Boost.Config macros for the new C++23 headers.

@ckormanyos
Copy link
Member

We were just tuning the exact header doing the recognition of this header. We used the macro __has_include exclusively.

John, do you think we should combine thas PP querry with a check on __cplusplus to ensure that it is also high enough?

@jzmaddock
Copy link
Collaborator

We were just tuning the exact header doing the recognition of this header. We used the macro __has_include exclusively.

John, do you think we should combine thas PP querry with a check on __cplusplus to ensure that it is also high enough?

You always have to do that: __has_Include only tells you whether the file exists on disk, not whether you can actually include it in the current -std= mode. That's why we have Boost.Config macros to handle this and make it less error prone, I just haven't added those for C++23 yet!

@mborland
Copy link
Member

That's my mistake. I'll just keep going with greater than 202002L because there's no macro definition for C++23 yet, and <stdfloat> does not have a feature test macro either: https://en.cppreference.com/w/cpp/feature_test

mborland added a commit that referenced this issue Aug 28, 2023
@mborland mborland linked a pull request Aug 28, 2023 that will close this issue
@ckormanyos
Copy link
Member

keep going with greater than 202002L because there's no macro definition for C++23 yet, and <stdfloat> does not have a feature test macro either

Awesome plan. Before I wrack my brain with the PP logic, could you please do this Matt, as you're more practiced at it than I?

@ckormanyos
Copy link
Member

Ahhh you already beat me to it with #1023 sorry about the noise. Thanks guys and thanks Christophe (@ChristophStrehle)

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 a pull request may close this issue.

4 participants