Skip to content

Commit 189f512

Browse files
committed
Merge commit '57500cd6a013a1e438878b04cd4530673ab5533e' into llvmspirv_pulldown
2 parents 7f01265 + 57500cd commit 189f512

File tree

78 files changed

+1632
-1791
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+1632
-1791
lines changed

libcxx/docs/FeatureTestMacroTable.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,8 @@ Status
422422
---------------------------------------------------------- -----------------
423423
``__cpp_lib_constexpr_new`` ``202406L``
424424
---------------------------------------------------------- -----------------
425+
``__cpp_lib_constexpr_queue`` ``202502L``
426+
---------------------------------------------------------- -----------------
425427
``__cpp_lib_constrained_equality`` *unimplemented*
426428
---------------------------------------------------------- -----------------
427429
``__cpp_lib_copyable_function`` *unimplemented*

libcxx/docs/ReleaseNotes/21.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ Potentially breaking changes
9797
- The implementation of ``num_put::do_put`` has been replaced to improve the performance, which can lead to different
9898
output when printing pointers.
9999

100+
- User-defined specializations of ``std::common_reference`` are diagnosed now. To customize the common reference type, ``std::basic_common_reference`` should be specialized instead.
101+
100102
Announcements About Future Releases
101103
-----------------------------------
102104

libcxx/include/__type_traits/common_reference.h

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,18 @@ struct __common_ref {};
109109
// Note C: For the common_reference trait applied to a parameter pack [...]
110110

111111
template <class...>
112-
struct common_reference;
112+
struct _LIBCPP_NO_SPECIALIZATIONS common_reference;
113113

114114
template <class... _Types>
115115
using common_reference_t = typename common_reference<_Types...>::type;
116116

117+
template <class, class, template <class> class, template <class> class>
118+
struct basic_common_reference {};
119+
120+
_LIBCPP_DIAGNOSTIC_PUSH
121+
# if __has_warning("-Winvalid-specialization")
122+
_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Winvalid-specialization")
123+
# endif
117124
// bullet 1 - sizeof...(T) == 0
118125
template <>
119126
struct common_reference<> {};
@@ -145,9 +152,6 @@ struct __common_reference_sub_bullet1<_Tp, _Up> {
145152

146153
// sub-bullet 2 - Otherwise, if basic_common_reference<remove_cvref_t<T1>, remove_cvref_t<T2>, XREF(T1), XREF(T2)>::type
147154
// is well-formed, then the member typedef `type` denotes that type.
148-
template <class, class, template <class> class, template <class> class>
149-
struct basic_common_reference {};
150-
151155
template <class _Tp, class _Up>
152156
using __basic_common_reference_t _LIBCPP_NODEBUG =
153157
typename basic_common_reference<remove_cvref_t<_Tp>,
@@ -180,10 +184,11 @@ struct __common_reference_sub_bullet3 : common_type<_Tp, _Up> {};
180184
template <class _Tp, class _Up, class _Vp, class... _Rest>
181185
requires requires { typename common_reference_t<_Tp, _Up>; }
182186
struct common_reference<_Tp, _Up, _Vp, _Rest...> : common_reference<common_reference_t<_Tp, _Up>, _Vp, _Rest...> {};
187+
_LIBCPP_DIAGNOSTIC_POP
183188

184189
// bullet 5 - Otherwise, there shall be no member `type`.
185190
template <class...>
186-
struct common_reference {};
191+
struct _LIBCPP_NO_SPECIALIZATIONS common_reference {};
187192

188193
#endif // _LIBCPP_STD_VER >= 20
189194

libcxx/include/queue

Lines changed: 77 additions & 61 deletions
Large diffs are not rendered by default.

libcxx/include/version

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ __cpp_lib_constexpr_memory 202202L <memory>
7474
201811L // C++20
7575
__cpp_lib_constexpr_new 202406L <new>
7676
__cpp_lib_constexpr_numeric 201911L <numeric>
77+
__cpp_lib_constexpr_queue 202502L <queue>
7778
__cpp_lib_constexpr_string 201907L <string>
7879
__cpp_lib_constexpr_string_view 201811L <string_view>
7980
__cpp_lib_constexpr_tuple 201811L <tuple>
@@ -545,6 +546,7 @@ __cpp_lib_void_t 201411L <type_traits>
545546
# if !defined(_LIBCPP_ABI_VCRUNTIME)
546547
# define __cpp_lib_constexpr_new 202406L
547548
# endif
549+
# define __cpp_lib_constexpr_queue 202502L
548550
// # define __cpp_lib_constrained_equality 202403L
549551
// # define __cpp_lib_copyable_function 202306L
550552
// # define __cpp_lib_debugging 202311L

libcxx/test/libcxx/type_traits/no_specializations.verify.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,5 +186,12 @@ struct std::enable_if<true, S>; // expected-error {{cannot be specialized}}
186186
# if TEST_STD_VER >= 20
187187
template <>
188188
struct std::integral_constant<S, {}>; // expected-error {{cannot be specialized}}
189+
190+
template <>
191+
struct std::common_reference<S>; // expected-error {{cannot be specialized}}
192+
template <>
193+
struct std::common_reference<S, S>; // expected-error {{cannot be specialized}}
194+
template <>
195+
struct std::common_reference<S, S, S>; // expected-error {{cannot be specialized}}
189196
# endif
190197
#endif

libcxx/test/std/containers/Emplaceable.h

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,39 +15,41 @@
1515
#if TEST_STD_VER >= 11
1616

1717
class Emplaceable {
18-
Emplaceable(const Emplaceable&);
19-
Emplaceable& operator=(const Emplaceable&);
18+
TEST_CONSTEXPR Emplaceable(const Emplaceable&);
19+
TEST_CONSTEXPR_CXX14 Emplaceable& operator=(const Emplaceable&);
2020

2121
int int_;
2222
double double_;
2323

2424
public:
25-
Emplaceable() : int_(0), double_(0) {}
26-
Emplaceable(int i, double d) : int_(i), double_(d) {}
27-
Emplaceable(Emplaceable&& x) : int_(x.int_), double_(x.double_) {
25+
TEST_CONSTEXPR Emplaceable() : int_(0), double_(0) {}
26+
TEST_CONSTEXPR Emplaceable(int i, double d) : int_(i), double_(d) {}
27+
TEST_CONSTEXPR_CXX14 Emplaceable(Emplaceable&& x) : int_(x.int_), double_(x.double_) {
2828
x.int_ = 0;
2929
x.double_ = 0;
3030
}
31-
Emplaceable& operator=(Emplaceable&& x) {
31+
TEST_CONSTEXPR_CXX14 Emplaceable& operator=(Emplaceable&& x) {
3232
int_ = x.int_;
3333
x.int_ = 0;
3434
double_ = x.double_;
3535
x.double_ = 0;
3636
return *this;
3737
}
3838

39-
bool operator==(const Emplaceable& x) const { return int_ == x.int_ && double_ == x.double_; }
40-
bool operator<(const Emplaceable& x) const { return int_ < x.int_ || (int_ == x.int_ && double_ < x.double_); }
39+
TEST_CONSTEXPR bool operator==(const Emplaceable& x) const { return int_ == x.int_ && double_ == x.double_; }
40+
TEST_CONSTEXPR bool operator<(const Emplaceable& x) const {
41+
return int_ < x.int_ || (int_ == x.int_ && double_ < x.double_);
42+
}
4143

42-
int get() const { return int_; }
44+
TEST_CONSTEXPR int get() const { return int_; }
4345
};
4446

4547
template <>
4648
struct std::hash<Emplaceable> {
4749
typedef Emplaceable argument_type;
4850
typedef std::size_t result_type;
4951

50-
std::size_t operator()(const Emplaceable& x) const { return static_cast<std::size_t>(x.get()); }
52+
TEST_CONSTEXPR std::size_t operator()(const Emplaceable& x) const { return static_cast<std::size_t>(x.get()); }
5153
};
5254

5355
#endif // TEST_STD_VER >= 11

libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_alloc.pass.cpp

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,38 @@
1818
#include "test_allocator.h"
1919

2020
template <class T>
21-
struct test : public std::priority_queue<T, std::vector<T, test_allocator<T> > > {
21+
struct Test : public std::priority_queue<T, std::vector<T, test_allocator<T> > > {
2222
typedef std::priority_queue<T, std::vector<T, test_allocator<T> > > base;
2323
typedef typename base::container_type container_type;
2424
typedef typename base::value_compare value_compare;
2525

26-
explicit test(const test_allocator<int>& a) : base(a) {}
27-
test(const value_compare& comp, const test_allocator<int>& a) : base(comp, c, a) {}
28-
test(const value_compare& comp, const container_type& container, const test_allocator<int>& a)
26+
TEST_CONSTEXPR_CXX26 explicit Test(const test_allocator<int>& a) : base(a) {}
27+
TEST_CONSTEXPR_CXX26 Test(const value_compare& comp, const test_allocator<int>& a) : base(comp, c, a) {}
28+
TEST_CONSTEXPR_CXX26 Test(const value_compare& comp, const container_type& container, const test_allocator<int>& a)
2929
: base(comp, container, a) {}
3030
#if TEST_STD_VER >= 11
31-
test(const value_compare& comp, container_type&& container, const test_allocator<int>& a)
31+
TEST_CONSTEXPR_CXX26 Test(const value_compare& comp, container_type&& container, const test_allocator<int>& a)
3232
: base(comp, std::move(container), a) {}
33-
test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
33+
TEST_CONSTEXPR_CXX26 Test(Test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
3434
#endif
35-
test_allocator<int> get_allocator() { return c.get_allocator(); }
35+
TEST_CONSTEXPR_CXX26 test_allocator<int> get_allocator() { return c.get_allocator(); }
3636

3737
using base::c;
3838
};
3939

40-
int main(int, char**) {
41-
test<int> q((test_allocator<int>(3)));
40+
TEST_CONSTEXPR_CXX26 bool test() {
41+
Test<int> q((test_allocator<int>(3)));
4242
assert(q.c.get_allocator() == test_allocator<int>(3));
4343
assert(q.c.size() == 0);
4444

45+
return true;
46+
}
47+
48+
int main(int, char**) {
49+
assert(test());
50+
#if TEST_STD_VER >= 26
51+
static_assert(test());
52+
#endif
53+
4554
return 0;
4655
}

libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_alloc.pass.cpp

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,38 @@
1818
#include "test_allocator.h"
1919

2020
template <class T>
21-
struct test : public std::priority_queue<T, std::vector<T, test_allocator<T> > > {
21+
struct Test : public std::priority_queue<T, std::vector<T, test_allocator<T> > > {
2222
typedef std::priority_queue<T, std::vector<T, test_allocator<T> > > base;
2323
typedef typename base::container_type container_type;
2424
typedef typename base::value_compare value_compare;
2525

26-
explicit test(const test_allocator<int>& a) : base(a) {}
27-
test(const value_compare& compare, const test_allocator<int>& a) : base(compare, a) {}
28-
test(const value_compare& compare, const container_type& container, const test_allocator<int>& a)
26+
TEST_CONSTEXPR_CXX26 explicit Test(const test_allocator<int>& a) : base(a) {}
27+
TEST_CONSTEXPR_CXX26 Test(const value_compare& compare, const test_allocator<int>& a) : base(compare, a) {}
28+
TEST_CONSTEXPR_CXX26 Test(const value_compare& compare, const container_type& container, const test_allocator<int>& a)
2929
: base(compare, container, a) {}
3030
#if TEST_STD_VER >= 11
31-
test(const value_compare& compare, container_type&& container, const test_allocator<int>& a)
31+
TEST_CONSTEXPR_CXX26 Test(const value_compare& compare, container_type&& container, const test_allocator<int>& a)
3232
: base(compare, std::move(container), a) {}
33-
test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
33+
TEST_CONSTEXPR_CXX26 Test(Test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
3434
#endif
35-
test_allocator<int> get_allocator() { return c.get_allocator(); }
35+
TEST_CONSTEXPR_CXX26 test_allocator<int> get_allocator() { return c.get_allocator(); }
3636

3737
using base::c;
3838
};
3939

40-
int main(int, char**) {
41-
test<int> q(std::less<int>(), test_allocator<int>(3));
40+
TEST_CONSTEXPR_CXX26 bool test() {
41+
Test<int> q(std::less<int>(), test_allocator<int>(3));
4242
assert(q.c.get_allocator() == test_allocator<int>(3));
4343
assert(q.c.size() == 0);
4444

45-
return 0;
45+
return true;
4646
}
47+
48+
int main(int, char**) {
49+
assert(test());
50+
#if TEST_STD_VER >= 26
51+
static_assert(test());
52+
#endif
53+
54+
return 0;
55+
}

libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_cont_alloc.pass.cpp

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,40 +19,49 @@
1919
#include "test_allocator.h"
2020

2121
template <class C>
22-
C make(int n) {
22+
TEST_CONSTEXPR_CXX26 C make(int n) {
2323
C c;
2424
for (int i = 0; i < n; ++i)
2525
c.push_back(i);
2626
return c;
2727
}
2828

2929
template <class T>
30-
struct test : public std::priority_queue<T, std::vector<T, test_allocator<T> > > {
30+
struct Test : public std::priority_queue<T, std::vector<T, test_allocator<T> > > {
3131
typedef std::priority_queue<T, std::vector<T, test_allocator<T> > > base;
3232
typedef typename base::container_type container_type;
3333
typedef typename base::value_compare value_compare;
3434

35-
explicit test(const test_allocator<int>& a) : base(a) {}
36-
test(const value_compare& compare, const test_allocator<int>& a) : base(compare, a) {}
37-
test(const value_compare& compare, const container_type& container, const test_allocator<int>& a)
35+
TEST_CONSTEXPR_CXX26 explicit Test(const test_allocator<int>& a) : base(a) {}
36+
TEST_CONSTEXPR_CXX26 Test(const value_compare& compare, const test_allocator<int>& a) : base(compare, a) {}
37+
TEST_CONSTEXPR_CXX26 Test(const value_compare& compare, const container_type& container, const test_allocator<int>& a)
3838
: base(compare, container, a) {}
3939
#if TEST_STD_VER >= 11 // testing rvalue constructor
40-
test(const value_compare& compare, container_type&& container, const test_allocator<int>& a)
40+
TEST_CONSTEXPR_CXX26 Test(const value_compare& compare, container_type&& container, const test_allocator<int>& a)
4141
: base(compare, std::move(container), a) {}
42-
test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
42+
TEST_CONSTEXPR_CXX26 Test(Test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
4343
#endif
44-
test_allocator<int> get_allocator() { return c.get_allocator(); }
44+
TEST_CONSTEXPR_CXX26 test_allocator<int> get_allocator() { return c.get_allocator(); }
4545

4646
using base::c;
4747
};
4848

49-
int main(int, char**) {
49+
TEST_CONSTEXPR_CXX26 bool test() {
5050
typedef std::vector<int, test_allocator<int> > C;
5151
C v = make<C>(5);
52-
test<int> q(std::less<int>(), v, test_allocator<int>(3));
52+
Test<int> q(std::less<int>(), v, test_allocator<int>(3));
5353
assert(q.c.get_allocator() == test_allocator<int>(3));
5454
assert(q.size() == 5);
5555
assert(q.top() == 4);
5656

57+
return true;
58+
}
59+
60+
int main(int, char**) {
61+
assert(test());
62+
#if TEST_STD_VER >= 26
63+
static_assert(test());
64+
#endif
65+
5766
return 0;
5867
}

libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_rcont_alloc.pass.cpp

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,39 +19,48 @@
1919
#include "test_allocator.h"
2020

2121
template <class C>
22-
C make(int n) {
22+
TEST_CONSTEXPR_CXX26 C make(int n) {
2323
C c;
2424
for (int i = 0; i < n; ++i)
2525
c.push_back(i);
2626
return c;
2727
}
2828

2929
template <class T>
30-
struct test : public std::priority_queue<T, std::vector<T, test_allocator<T> > > {
30+
struct Test : public std::priority_queue<T, std::vector<T, test_allocator<T> > > {
3131
typedef std::priority_queue<T, std::vector<T, test_allocator<T> > > base;
3232
typedef typename base::container_type container_type;
3333
typedef typename base::value_compare value_compare;
3434

35-
explicit test(const test_allocator<int>& a) : base(a) {}
36-
test(const value_compare& compare, const test_allocator<int>& a) : base(compare, a) {}
37-
test(const value_compare& compare, const container_type& container, const test_allocator<int>& a)
35+
TEST_CONSTEXPR_CXX26 explicit Test(const test_allocator<int>& a) : base(a) {}
36+
TEST_CONSTEXPR_CXX26 Test(const value_compare& compare, const test_allocator<int>& a) : base(compare, a) {}
37+
TEST_CONSTEXPR_CXX26 Test(const value_compare& compare, const container_type& container, const test_allocator<int>& a)
3838
: base(compare, container, a) {}
3939
#if TEST_STD_VER >= 11 // testing rvalue ctor
40-
test(const value_compare& compare, container_type&& container, const test_allocator<int>& a)
40+
TEST_CONSTEXPR_CXX26 Test(const value_compare& compare, container_type&& container, const test_allocator<int>& a)
4141
: base(compare, std::move(container), a) {}
42-
test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
42+
TEST_CONSTEXPR_CXX26 Test(Test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
4343
#endif
44-
test_allocator<int> get_allocator() { return c.get_allocator(); }
44+
TEST_CONSTEXPR_CXX26 test_allocator<int> get_allocator() { return c.get_allocator(); }
4545

4646
using base::c;
4747
};
4848

49-
int main(int, char**) {
49+
TEST_CONSTEXPR_CXX26 bool test() {
5050
typedef std::vector<int, test_allocator<int> > C;
51-
test<int> q(std::less<int>(), make<C>(5), test_allocator<int>(3));
51+
Test<int> q(std::less<int>(), make<C>(5), test_allocator<int>(3));
5252
assert(q.c.get_allocator() == test_allocator<int>(3));
5353
assert(q.size() == 5);
5454
assert(q.top() == 4);
5555

56+
return true;
57+
}
58+
59+
int main(int, char**) {
60+
assert(test());
61+
#if TEST_STD_VER >= 26
62+
static_assert(test());
63+
#endif
64+
5665
return 0;
5766
}

0 commit comments

Comments
 (0)