STL icon indicating copy to clipboard operation
STL copied to clipboard

P3508R0 `constexpr` For Raw Memory Algorithms

Open StephanTLavavej opened this issue 1 year ago • 1 comments

WG21-P3508R0 constexpr For Raw Memory Algorithms WG21-P3369R0 constexpr For uninitialized_default_construct() LWG-4452 Make deref-move constexpr

INCREASED feature-test macro (expected):

#define __cpp_lib_raw_memory_algorithms 202411L

This depends on WG21-P2747R2 constexpr Placement new, implemented in Clang 20, so we'll be able to make progress with at least one compiler.

Note: We're focused on implementing the remaining library-only features in C++23. Until that's done, we will NOT be accepting PRs for C++26 features.

StephanTLavavej avatar Nov 25 '24 23:11 StephanTLavavej

Both MSVC and Clang (but perhaps not EDG, unfortunately) provide magics supporting this before implementing WG21-P2747R2. Godbolt link. It seems that currently (or before C++26) EDG must perform constexpr placement new in std::construct_at.

However, when the value type is an array (although this is a rare case), the support is currently broken. Clang can't placement-new arrays in constant evaluation at all before ver 20. MSVC (and EDG in std::construct_at, in the case of LWG-3436) currently can, but there're now some bugs that can't be worked around.

frederick-vs-ja avatar Nov 27 '24 03:11 frederick-vs-ja