Skip to content

Commit ee5e9b9

Browse files
committed
[libcxx] Fix transform_error.mandates.verify.cpp on msvc
PR llvm#102851 marks reference types in union as error on msvc by changing the clang, which makes 'transform_error.mandates.verify.cpp' no longer failing on msvc from ToT. However, all libcxx buildbots do not build clang from source, therefore, this test will still fail on these bots, which is incorrect. This patch changed the expected error message of this test so it can pass with both release branch clang and ToT clang.
1 parent 51ede55 commit ee5e9b9

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,12 @@
1313
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
1414

1515
// With clang-cl, some warnings have a 'which is a Microsoft extension' suffix
16-
// which break the tests.
17-
// XFAIL: msvc
16+
// which break the tests. But #102851 will turn it into an error, making the test pass.
17+
// However, upstream libcxx buildbots do not build clang from source while testing, so
18+
// this tests still expected to fail on these bots.
19+
// TODO(LLVM 22): Remove '0-1' from 'expected-error-re@*:* 0-1 {{union member {{.*}} has reference type {{.*}}}}'
20+
// and remove 'expected-warning-re@*:* 0-1 {{union member {{.*}} has reference type {{.*}}, which is a Microsoft extension}}'
21+
// once LLVM 22 releases.
1822

1923
// Test the mandates
2024

@@ -56,11 +60,12 @@ void test() {
5660
e.transform_error(return_unexpected<int&>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}}
5761
// expected-error-re@*:* 0-1 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}}
5862
// expected-error-re@*:* {{static assertion failed {{.*}}[expected.object.general] A program that instantiates the definition of template expected<T, E> for {{.*}} is ill-formed.}}
59-
// expected-error-re@*:* {{union member {{.*}} has reference type {{.*}}}}
63+
// expected-error-re@*:* 0-1 {{union member {{.*}} has reference type {{.*}}}}
6064

6165
e.transform_error(return_no_object<int&>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}}
6266
// expected-error-re@*:* 0-1 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}}
6367
// expected-error-re@*:* {{static assertion failed {{.*}}[expected.object.general] A program that instantiates the definition of template expected<T, E> for {{.*}} is ill-formed.}}
68+
// expected-warning-re@*:* 0-1 {{union member {{.*}} has reference type {{.*}}, which is a Microsoft extension}}
6469
}
6570

6671
// Test const& overload

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,13 @@
1313
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
1414

1515
// With clang-cl, some warnings have a 'which is a Microsoft extension' suffix
16-
// which break the tests.
17-
// XFAIL: msvc
16+
// which break the tests. But #102851 will turn it into an error, making the test pass.
17+
// However, upstream libcxx buildbots do not build clang from source while testing, so
18+
// this tests still expected to fail on these bots.
19+
// TODO(LLVM 22): Remove '0-1' from 'expected-error-re@*:* 0-1 {{union member {{.*}} has reference type {{.*}}}}'
20+
// and remove 'expected-warning-re@*:* 0-1 {{union member {{.*}} has reference type {{.*}}, which is a Microsoft extension}}'
21+
// and remove 'expected-error-re@*:* 0-1 {{call to deleted constructor of {{.*}}}}'
22+
// once LLVM 22 releases.
1823

1924
// Test the mandates
2025

@@ -57,11 +62,12 @@ void test() {
5762
// expected-error-re@*:* 0-1 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}}
5863
// expected-error-re@*:* {{static assertion failed {{.*}}A program that instantiates expected<T, E> with a E that is not a valid argument for unexpected<E> is ill-formed}}
5964
// expected-error-re@*:* 0-1 {{call to deleted constructor of {{.*}}}}
60-
// expected-error-re@*:* {{union member {{.*}} has reference type {{.*}}}}
65+
// expected-error-re@*:* 0-1 {{union member {{.*}} has reference type {{.*}}}}
6166

6267
e.transform_error(return_no_object<int&>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}}
6368
// expected-error-re@*:* 0-1 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}}
6469
// expected-error-re@*:* {{static assertion failed {{.*}}A program that instantiates expected<T, E> with a E that is not a valid argument for unexpected<E> is ill-formed}}
70+
// expected-warning-re@*:* 0-1 {{union member {{.*}} has reference type {{.*}}, which is a Microsoft extension}}
6571
}
6672

6773
// Test const& overload
@@ -71,6 +77,7 @@ void test() {
7177
// expected-error-re@*:* 0-1 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}}
7278
e.transform_error(return_no_object<const int &>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}}
7379
// expected-error-re@*:* 0-1 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}}
80+
// expected-error-re@*:* 0-1 {{call to deleted constructor of {{.*}}}}
7481
}
7582

7683
// Test && overload

0 commit comments

Comments
 (0)