Skip to content

Commit 27e686c

Browse files
[libc++] Verify that LWG4140 is implemented (#128624)
According to the commit history, the constructors removed by LWG4140 have never been added to libc++. Existence of non-public or deleted default constructor is observable, this patch tests that there's no such default constructor at all.
1 parent a216358 commit 27e686c

File tree

3 files changed

+68
-1
lines changed

3 files changed

+68
-1
lines changed

libcxx/docs/Status/Cxx2cIssues.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
"`LWG4126 <https://wg21.link/LWG4126>`__","Some feature-test macros for fully freestanding features are not yet marked freestanding","2024-11 (Wrocław)","","",""
9999
"`LWG4134 <https://wg21.link/LWG4134>`__","Issue with Philox algorithm specification","2024-11 (Wrocław)","","",""
100100
"`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",""
101-
"`LWG4140 <https://wg21.link/LWG4140>`__","Useless default constructors for bit reference types","2024-11 (Wrocław)","","",""
101+
"`LWG4140 <https://wg21.link/LWG4140>`__","Useless default constructors for bit reference types","2024-11 (Wrocław)","|Nothing To Do|","",""
102102
"`LWG4141 <https://wg21.link/LWG4141>`__","Improve prohibitions on ""additional storage""","2024-11 (Wrocław)","","",""
103103
"`LWG4142 <https://wg21.link/LWG4142>`__","``format_parse_context::check_dynamic_spec`` should require at least one type","2024-11 (Wrocław)","","",""
104104
"`LWG4144 <https://wg21.link/LWG4144>`__","Disallow ``unique_ptr<T&, D>``","2024-11 (Wrocław)","","",""
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
// <vector>
10+
11+
#include <vector>
12+
#include <type_traits>
13+
14+
#include "test_allocator.h"
15+
#include "test_macros.h"
16+
17+
static_assert(!std::is_default_constructible<std::vector<bool>::reference>::value, "");
18+
static_assert(!std::is_default_constructible<std::vector<bool, test_allocator<bool> >::reference>::value, "");
19+
20+
#if TEST_STD_VER >= 11
21+
void test_no_ambiguity_among_default_constructors(std::enable_if<false>);
22+
void test_no_ambiguity_among_default_constructors(std::vector<bool>::reference);
23+
void test_no_ambiguity_among_default_constructors(std::vector<bool, test_allocator<bool>>::reference);
24+
25+
ASSERT_SAME_TYPE(decltype(test_no_ambiguity_among_default_constructors({})), void);
26+
#endif
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
// <bitset>
10+
11+
#include <bitset>
12+
#include <type_traits>
13+
14+
#include "test_macros.h"
15+
16+
static_assert(!std::is_default_constructible<std::bitset<0>::reference>::value, "");
17+
static_assert(!std::is_default_constructible<std::bitset<1>::reference>::value, "");
18+
static_assert(!std::is_default_constructible<std::bitset<8>::reference>::value, "");
19+
static_assert(!std::is_default_constructible<std::bitset<12>::reference>::value, "");
20+
static_assert(!std::is_default_constructible<std::bitset<16>::reference>::value, "");
21+
static_assert(!std::is_default_constructible<std::bitset<24>::reference>::value, "");
22+
static_assert(!std::is_default_constructible<std::bitset<32>::reference>::value, "");
23+
static_assert(!std::is_default_constructible<std::bitset<48>::reference>::value, "");
24+
static_assert(!std::is_default_constructible<std::bitset<64>::reference>::value, "");
25+
static_assert(!std::is_default_constructible<std::bitset<96>::reference>::value, "");
26+
27+
#if TEST_STD_VER >= 11
28+
void test_no_ambiguity_among_default_constructors(std::enable_if<false>);
29+
void test_no_ambiguity_among_default_constructors(std::bitset<0>::reference);
30+
void test_no_ambiguity_among_default_constructors(std::bitset<1>::reference);
31+
void test_no_ambiguity_among_default_constructors(std::bitset<8>::reference);
32+
void test_no_ambiguity_among_default_constructors(std::bitset<12>::reference);
33+
void test_no_ambiguity_among_default_constructors(std::bitset<16>::reference);
34+
void test_no_ambiguity_among_default_constructors(std::bitset<24>::reference);
35+
void test_no_ambiguity_among_default_constructors(std::bitset<32>::reference);
36+
void test_no_ambiguity_among_default_constructors(std::bitset<48>::reference);
37+
void test_no_ambiguity_among_default_constructors(std::bitset<64>::reference);
38+
void test_no_ambiguity_among_default_constructors(std::bitset<96>::reference);
39+
40+
ASSERT_SAME_TYPE(decltype(test_no_ambiguity_among_default_constructors({})), void);
41+
#endif

0 commit comments

Comments
 (0)