-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
P0533R9 constexpr
For <cmath>
And <cstdlib>
#2530
Comments
We need to investigate this sooner rather than later to determine exactly how we're going to make UCRT functions |
I think it is implementable without compiler support. You have Compiler support looks better though. Be sure to have it in clang-cl either. |
I don't think compiler support is essentially needed (but may be nice to have). We can ask UCRT not to declare these functions, but to provide some equivalent functions with different names (e.g. Perhaps we can provide "some equivalent functions with different names" in MSVC STL only, by Edit: The alternatename trick is unnecessary. I guess we can just sweep UCRT functions in a non-global internal namespace in C++ modes. |
a few initial thoughts from LLVM discord: https://discord.com/channels/636084430946959380/636732781086638081/942850475752062989 @ldionne wrote:
// inside <math.h>
int abs(int);
// inside <cmath>
namespace std {
constexpr int abs(int) {...}
}
// user code:
using namespace std;
abs(1); // which one is meant?
|
I've contacted the compiler team about getting support for this. |
We should ask the compiler team to consider implementing #3789 at the same time to save work. |
The attribute [[msvc::constexpr]] allows "extended constexpr" in C++20 such as calling placement new from within a constexpr function for std::construct_at, could that attribute be extended to allow using these blessed functions in a constant expression? Seems like the least painful approach in terms of existing blessed constexpr and without needing to reimplement every function manually again |
I think the crux is the UCRT headers (mainly |
Ah, it seems that no progress seem was made since then. If MS had allowed us to touch related UCRT headers or reorganize them like |
P0533R9
constexpr
For<cmath>
And<cstdlib>
LWG-3834 Missing
constexpr
forstd::intmax_t
math functions in<cinttypes>
Feature-test macro:
The text was updated successfully, but these errors were encountered: