Skip to content

[libc++] Fix constant initialization of unique_ptr in C++17 and prior #108956

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

Merged
merged 1 commit into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libcxx/include/__memory/compressed_pair.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ template <class _ToPad,
bool _Empty = ((is_empty<_ToPad>::value && !__libcpp_is_final<_ToPad>::value) ||
is_reference<_ToPad>::value || sizeof(_ToPad) == __datasizeof_v<_ToPad>)>
class __compressed_pair_padding {
char __padding_[sizeof(_ToPad) - __datasizeof_v<_ToPad>];
char __padding_[sizeof(_ToPad) - __datasizeof_v<_ToPad>] = {};
};

template <class _ToPad>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ int main(int, char**)
struct TestConstexpr : public std::any {
constexpr TestConstexpr() : std::any() {}
};
static TEST_CONSTINIT std::any a;
TEST_CONSTINIT static std::any a;
(void)a;
}
{
Expand Down
6 changes: 4 additions & 2 deletions libcxx/test/support/test_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,11 @@
#endif

#if TEST_STD_VER > 17
#define TEST_CONSTINIT constinit
# define TEST_CONSTINIT constinit
#elif __has_cpp_attribute(clang::require_constant_initialization)
# define TEST_CONSTINIT [[clang::require_constant_initialization]]
#else
#define TEST_CONSTINIT
# define TEST_CONSTINIT
#endif

#if TEST_STD_VER < 11
Expand Down
Loading