Skip to content

Commit 9c9a32d

Browse files
committed
Update diagnostics checks in libc++ tests.
1 parent 30935f3 commit 9c9a32d

File tree

9 files changed

+21
-0
lines changed

9 files changed

+21
-0
lines changed

clang/lib/Sema/SemaTypeTraits.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "clang/AST/DeclCXX.h"
1414
#include "clang/AST/TemplateBase.h"
1515
#include "clang/AST/Type.h"
16+
#include "clang/Basic/DiagnosticIDs.h"
1617
#include "clang/Basic/DiagnosticParse.h"
1718
#include "clang/Basic/DiagnosticSema.h"
1819
#include "clang/Basic/TypeTraits.h"

libcxx/test/libcxx/utilities/expected/expected.expected/and_then.mandates.verify.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ void test() {
5555
// expected-error-re@*:* {{static assertion failed {{.*}}The result of f(value()) must be a specialization of std::expected}}
5656
// expected-error-re@*:* {{{{.*}}cannot be used prior to '::' because it has no members}}
5757
// expected-error-re@*:* {{no matching constructor for initialization of{{.*}}}}
58+
// expected-error@*:* {{excess elements in struct initializer}}
5859
}
5960

6061
// !std::is_same_v<U:error_type, E>
@@ -74,6 +75,7 @@ void test() {
7475
// expected-error-re@*:* {{static assertion failed {{.*}}The result of f(value()) must be a specialization of std::expected}}
7576
// expected-error-re@*:* {{{{.*}}cannot be used prior to '::' because it has no members}}
7677
// expected-error-re@*:* {{no matching constructor for initialization of{{.*}}}}
78+
// expected-error@*:* {{excess elements in struct initializer}}
7779
}
7880

7981
// !std::is_same_v<U:error_type, E>
@@ -94,6 +96,7 @@ void test() {
9496
// expected-error-re@*:* {{static assertion failed {{.*}}The result of f(std::move(value())) must be a specialization of std::expected}}
9597
// expected-error-re@*:* {{{{.*}}cannot be used prior to '::' because it has no members}}
9698
// expected-error-re@*:* {{no matching constructor for initialization of{{.*}}}}
99+
// expected-error@*:* {{excess elements in struct initializer}}
97100
}
98101

99102
// !std::is_same_v<U:error_type, E>
@@ -113,6 +116,7 @@ void test() {
113116
// expected-error-re@*:* {{static assertion failed {{.*}}The result of f(std::move(value())) must be a specialization of std::expected}}
114117
// expected-error-re@*:* {{{{.*}}cannot be used prior to '::' because it has no members}}
115118
// expected-error-re@*:* {{no matching constructor for initialization of{{.*}}}}
119+
// expected-error@*:* {{excess elements in struct initializer}}
116120
}
117121

118122
// !std::is_same_v<U:error_type, E>

libcxx/test/libcxx/utilities/expected/expected.expected/or_else.mandates.verify.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ void test() {
5555
// expected-error-re@*:* {{static assertion failed {{.*}}The result of f(error()) must be a specialization of std::expected}}
5656
// expected-error-re@*:* {{{{.*}}cannot be used prior to '::' because it has no members}}
5757
// expected-error-re@*:* {{no matching constructor for initialization of{{.*}}}}
58+
// expected-error@*:* {{excess elements in struct initializer}}
5859
}
5960

6061
// !std::is_same_v<G:value_type, T>
@@ -74,6 +75,7 @@ void test() {
7475
// expected-error-re@*:* {{static assertion failed {{.*}}The result of f(error()) must be a specialization of std::expected}}
7576
// expected-error-re@*:* {{{{.*}}cannot be used prior to '::' because it has no members}}
7677
// expected-error-re@*:* {{no matching constructor for initialization of{{.*}}}}
78+
// expected-error@*:* {{excess elements in struct initializer}}
7779
}
7880

7981
// !std::is_same_v<G:value_type, T>
@@ -93,6 +95,7 @@ void test() {
9395
// expected-error-re@*:* {{static assertion failed {{.*}}The result of f(std::move(error())) must be a specialization of std::expected}}
9496
// expected-error-re@*:* {{{{.*}}cannot be used prior to '::' because it has no members}}
9597
// expected-error-re@*:* {{no matching constructor for initialization of{{.*}}}}
98+
// expected-error@*:* {{excess elements in struct initializer}}
9699
}
97100

98101
// !std::is_same_v<G:value_type, T>
@@ -112,6 +115,7 @@ void test() {
112115
// expected-error-re@*:* {{static assertion failed {{.*}}The result of f(std::move(error())) must be a specialization of std::expected}}
113116
// expected-error-re@*:* {{{{.*}}cannot be used prior to '::' because it has no members}}
114117
// expected-error-re@*:* {{no matching constructor for initialization of{{.*}}}}
118+
// expected-error@*:* {{excess elements in struct initializer}}
115119
}
116120

117121
// !std::is_same_v<G:value_type, T>

libcxx/test/libcxx/utilities/expected/expected.expected/value.observers.verify.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ void test() {
8282
std::expected<int, MoveOnly> e;
8383
[[maybe_unused]] auto val = std::move(e).value();
8484
// expected-error-re@*:* {{static assertion failed {{.*}}error_type has to be both copy constructible and constructible from decltype(std::move(error()))}}
85+
// expected-error@*:* {{call to deleted constructor of 'MoveOnly'}}
8586
}
8687

8788
// is_copy_constructible_v<E> is true and is_constructible_v<E, decltype(std::move(error()))> is true.
@@ -95,6 +96,7 @@ void test() {
9596
std::expected<int, CopyConstructibleButNotMoveConstructible> e;
9697
[[maybe_unused]] auto val = std::move(e).value();
9798
// expected-error-re@*:* {{static assertion failed {{.*}}error_type has to be both copy constructible and constructible from decltype(std::move(error()))}}
99+
// expected-error@*:* {{call to deleted constructor of 'CopyConstructibleButNotMoveConstructible'}}
98100
}
99101
}
100102

libcxx/test/libcxx/utilities/expected/expected.void/and_then.mandates.verify.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ void test() {
5555
// expected-error-re@*:* {{static assertion failed {{.*}}The result of f() must be a specialization of std::expected}}
5656
// expected-error-re@*:* {{{{.*}}cannot be used prior to '::' because it has no members}}
5757
// expected-error-re@*:* {{no matching constructor for initialization of{{.*}}}}
58+
// expected-error@*:* {{excess elements in struct initializer}}
5859
}
5960

6061
// !std::is_same_v<U:error_type, E>
@@ -74,6 +75,7 @@ void test() {
7475
// expected-error-re@*:* {{static assertion failed {{.*}}The result of f() must be a specialization of std::expected}}
7576
// expected-error-re@*:* {{{{.*}}cannot be used prior to '::' because it has no members}}
7677
// expected-error-re@*:* {{no matching constructor for initialization of{{.*}}}}
78+
// expected-error@*:* {{excess elements in struct initializer}}
7779
}
7880

7981
// !std::is_same_v<U:error_type, E>
@@ -93,6 +95,7 @@ void test() {
9395
// expected-error-re@*:* {{static assertion failed {{.*}}The result of f() must be a specialization of std::expected}}
9496
// expected-error-re@*:* {{{{.*}}cannot be used prior to '::' because it has no members}}
9597
// expected-error-re@*:* {{no matching constructor for initialization of{{.*}}}}
98+
// expected-error@*:* {{excess elements in struct initializer}}
9699
}
97100

98101
// !std::is_same_v<U:error_type, E>
@@ -112,6 +115,7 @@ void test() {
112115
// expected-error-re@*:* {{static assertion failed {{.*}}The result of f() must be a specialization of std::expected}}
113116
// expected-error-re@*:* {{{{.*}}cannot be used prior to '::' because it has no members}}
114117
// expected-error-re@*:* {{no matching constructor for initialization of{{.*}}}}
118+
// expected-error@*:* {{excess elements in struct initializer}}
115119
}
116120

117121
// !std::is_same_v<U:error_type, E>

libcxx/test/std/containers/sequences/array/array.creation/to_array.verify.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ int main(int, char**) {
2929
MoveOnly mo[] = {MoveOnly{3}};
3030
// expected-error@array:* {{to_array requires copy constructible elements}}
3131
// expected-error-re@array:* {{{{(call to implicitly-deleted copy constructor of 'MoveOnly')|(call to deleted constructor of 'MoveOnly')}}}}
32+
// expected-error@array:* {{call to deleted constructor of 'MoveOnly'}}
3233
std::to_array(mo); // expected-note {{requested here}}
3334
}
3435

libcxx/test/std/containers/views/mdspan/mdspan/conversion.verify.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ void cant_construct_data_handle_type() {
4343
int data;
4444
std::mdspan<int, std::extents<int>, std::layout_right, convertible_accessor_but_not_handle<int>> m_nc(&data);
4545
// expected-error-re@*:* {{{{.*}}no matching constructor for initialization of {{.*}} (aka 'not_const_convertible_handle<const int>')}}
46+
// expected-error@*:* {{no matching constructor for initialization of 'not_const_convertible_handle<const int>'}}
4647
// expected-error-re@*:* {{static assertion failed {{.*}}mdspan: incompatible data_handle_type for mdspan construction}}
4748
[[maybe_unused]] std::
4849
mdspan<const int, std::extents<int>, std::layout_right, convertible_accessor_but_not_handle<const int>> m_c(m_nc);
@@ -52,5 +53,6 @@ void mapping_constructible_despite_extents_compatibility() {
5253
int data;
5354
std::mdspan<int, std::extents<int>, always_convertible_layout> m(&data);
5455
// expected-error-re@*:* {{static assertion failed {{.*}}mdspan: incompatible extents for mdspan construction}}
56+
// expected-error@*:* {{no matching constructor for initialization of 'std::extents<int, 5>'}}
5557
[[maybe_unused]] std::mdspan<int, std::extents<int, 5>, always_convertible_layout> m2(m);
5658
}

libcxx/test/std/utilities/function.objects/func.bind.partial/bind_back.verify.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ void test() {
6969
auto f = std::bind_back([](const Arg&) {}, x);
7070
// expected-error-re@*:* {{static assertion failed{{.*}}bind_back requires all decay_t<Args> to be constructible from respective Args}}
7171
// expected-error@*:* {{no matching constructor for initialization}}
72+
// expected-error@*:* {{call to deleted constructor of 'F'}}
73+
// expected-error@*:* {{call to deleted constructor of 'Arg'}}
7274
}
7375

7476
{ // Mandates: (is_move_constructible_v<decay_t<Args>> && ...)

libcxx/test/std/utilities/function.objects/func.bind_front/bind_front.verify.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,5 @@ void f() {
4242
auto d = std::bind_front(do_nothing, n); // expected-error {{no matching function for call to 'bind_front'}}
4343

4444
auto t = std::bind_front(testNotMoveConst, NotMoveConst(0)); // expected-error {{no matching function for call to 'bind_front'}}
45+
// expected-error@*:* {{call to deleted constructor of 'NotMoveConst'}}
4546
}

0 commit comments

Comments
 (0)