Skip to content

[libc++] Verify that LWG4140 is implemented #128624

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 4 commits into from
Mar 6, 2025
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/docs/Status/Cxx2cIssues.csv
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"`LWG4126 <https://wg21.link/LWG4126>`__","Some feature-test macros for fully freestanding features are not yet marked freestanding","2024-11 (Wrocław)","","",""
"`LWG4134 <https://wg21.link/LWG4134>`__","Issue with Philox algorithm specification","2024-11 (Wrocław)","","",""
"`LWG4135 <https://wg21.link/LWG4135>`__","The helper lambda of ``std::erase`` for list should specify return type as ``bool``","2024-11 (Wrocław)","|Complete|","21",""
"`LWG4140 <https://wg21.link/LWG4140>`__","Useless default constructors for bit reference types","2024-11 (Wrocław)","","",""
"`LWG4140 <https://wg21.link/LWG4140>`__","Useless default constructors for bit reference types","2024-11 (Wrocław)","|Nothing To Do|","",""
"`LWG4141 <https://wg21.link/LWG4141>`__","Improve prohibitions on ""additional storage""","2024-11 (Wrocław)","","",""
"`LWG4142 <https://wg21.link/LWG4142>`__","``format_parse_context::check_dynamic_spec`` should require at least one type","2024-11 (Wrocław)","","",""
"`LWG4144 <https://wg21.link/LWG4144>`__","Disallow ``unique_ptr<T&, D>``","2024-11 (Wrocław)","","",""
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

// <vector>

#include <vector>
#include <type_traits>

#include "test_allocator.h"
#include "test_macros.h"

static_assert(!std::is_default_constructible<std::vector<bool>::reference>::value, "");
static_assert(!std::is_default_constructible<std::vector<bool, test_allocator<bool> >::reference>::value, "");

#if TEST_STD_VER >= 11
void test_no_ambiguity_among_default_constructors(std::enable_if<false>);
void test_no_ambiguity_among_default_constructors(std::vector<bool>::reference);
void test_no_ambiguity_among_default_constructors(std::vector<bool, test_allocator<bool>>::reference);

ASSERT_SAME_TYPE(decltype(test_no_ambiguity_among_default_constructors({})), void);
#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

// <bitset>

#include <bitset>
#include <type_traits>

#include "test_macros.h"

static_assert(!std::is_default_constructible<std::bitset<0>::reference>::value, "");
static_assert(!std::is_default_constructible<std::bitset<1>::reference>::value, "");
static_assert(!std::is_default_constructible<std::bitset<8>::reference>::value, "");
static_assert(!std::is_default_constructible<std::bitset<12>::reference>::value, "");
static_assert(!std::is_default_constructible<std::bitset<16>::reference>::value, "");
static_assert(!std::is_default_constructible<std::bitset<24>::reference>::value, "");
static_assert(!std::is_default_constructible<std::bitset<32>::reference>::value, "");
static_assert(!std::is_default_constructible<std::bitset<48>::reference>::value, "");
static_assert(!std::is_default_constructible<std::bitset<64>::reference>::value, "");
static_assert(!std::is_default_constructible<std::bitset<96>::reference>::value, "");

#if TEST_STD_VER >= 11
void test_no_ambiguity_among_default_constructors(std::enable_if<false>);
void test_no_ambiguity_among_default_constructors(std::bitset<0>::reference);
void test_no_ambiguity_among_default_constructors(std::bitset<1>::reference);
void test_no_ambiguity_among_default_constructors(std::bitset<8>::reference);
void test_no_ambiguity_among_default_constructors(std::bitset<12>::reference);
void test_no_ambiguity_among_default_constructors(std::bitset<16>::reference);
void test_no_ambiguity_among_default_constructors(std::bitset<24>::reference);
void test_no_ambiguity_among_default_constructors(std::bitset<32>::reference);
void test_no_ambiguity_among_default_constructors(std::bitset<48>::reference);
void test_no_ambiguity_among_default_constructors(std::bitset<64>::reference);
void test_no_ambiguity_among_default_constructors(std::bitset<96>::reference);

ASSERT_SAME_TYPE(decltype(test_no_ambiguity_among_default_constructors({})), void);
#endif