[libcxx-commits] [libcxx] e31322b - [libc++] Fix transform_error.mandates.verify.cpp test on msvc (#104635)
via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Aug 22 10:38:03 PDT 2024
Author: Haowei
Date: 2024-08-22T13:37:59-04:00
New Revision: e31322ba59071b4aa288c9d956f4c9d1ee10b080
URL: https://github.com/llvm/llvm-project/commit/e31322ba59071b4aa288c9d956f4c9d1ee10b080
DIFF: https://github.com/llvm/llvm-project/commit/e31322ba59071b4aa288c9d956f4c9d1ee10b080.diff
LOG: [libc++] Fix transform_error.mandates.verify.cpp test on msvc (#104635)
PR #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.
Added:
Modified:
libcxx/test/libcxx/utilities/expected/expected.expected/transform_error.mandates.verify.cpp
libcxx/test/libcxx/utilities/expected/expected.void/transform_error.mandates.verify.cpp
Removed:
################################################################################
diff --git a/libcxx/test/libcxx/utilities/expected/expected.expected/transform_error.mandates.verify.cpp b/libcxx/test/libcxx/utilities/expected/expected.expected/transform_error.mandates.verify.cpp
index 5bf094bf37709d..61374094b7adfb 100644
--- a/libcxx/test/libcxx/utilities/expected/expected.expected/transform_error.mandates.verify.cpp
+++ b/libcxx/test/libcxx/utilities/expected/expected.expected/transform_error.mandates.verify.cpp
@@ -13,8 +13,13 @@
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// With clang-cl, some warnings have a 'which is a Microsoft extension' suffix
-// which break the tests.
-// XFAIL: msvc
+// which break the tests. But #102851 will turn it into an error, making the test pass.
+// However, upstream libcxx buildbots do not build clang from source while testing, so
+// this tests still expected to fail on these bots.
+//
+// TODO(LLVM 22): Remove '0-1' from 'expected-error-re@*:* 0-1 {{union member {{.*}} has reference type {{.*}}}}'
+// and remove 'expected-warning-re@*:* 0-1 {{union member {{.*}} has reference type {{.*}}, which is a Microsoft extension}}'
+// once LLVM 22 releases. See https://github.com/llvm/llvm-project/issues/104885.
// Test the mandates
@@ -56,11 +61,12 @@ void test() {
e.transform_error(return_unexpected<int&>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}}
// expected-error-re@*:* 0-1 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}}
// expected-error-re@*:* {{static assertion failed {{.*}}[expected.object.general] A program that instantiates the definition of template expected<T, E> for {{.*}} is ill-formed.}}
- // expected-error-re@*:* {{union member {{.*}} has reference type {{.*}}}}
+ // expected-error-re@*:* 0-1 {{union member {{.*}} has reference type {{.*}}}}
e.transform_error(return_no_object<int&>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}}
// expected-error-re@*:* 0-1 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}}
// expected-error-re@*:* {{static assertion failed {{.*}}[expected.object.general] A program that instantiates the definition of template expected<T, E> for {{.*}} is ill-formed.}}
+ // expected-warning-re@*:* 0-1 {{union member {{.*}} has reference type {{.*}}, which is a Microsoft extension}}
}
// Test const& overload
diff --git a/libcxx/test/libcxx/utilities/expected/expected.void/transform_error.mandates.verify.cpp b/libcxx/test/libcxx/utilities/expected/expected.void/transform_error.mandates.verify.cpp
index 508b01a7bcea39..16233cd90d2199 100644
--- a/libcxx/test/libcxx/utilities/expected/expected.void/transform_error.mandates.verify.cpp
+++ b/libcxx/test/libcxx/utilities/expected/expected.void/transform_error.mandates.verify.cpp
@@ -13,8 +13,14 @@
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// With clang-cl, some warnings have a 'which is a Microsoft extension' suffix
-// which break the tests.
-// XFAIL: msvc
+// which break the tests. But #102851 will turn it into an error, making the test pass.
+// However, upstream libcxx buildbots do not build clang from source while testing, so
+// this tests still expected to fail on these bots.
+//
+// TODO(LLVM 22): Remove '0-1' from 'expected-error-re@*:* 0-1 {{union member {{.*}} has reference type {{.*}}}}'
+// and remove 'expected-warning-re@*:* 0-1 {{union member {{.*}} has reference type {{.*}}, which is a Microsoft extension}}'
+// and remove 'expected-error-re@*:* 0-1 {{call to deleted constructor of {{.*}}}}'
+// once LLVM 22 releases. See See https://github.com/llvm/llvm-project/issues/104885.
// Test the mandates
@@ -57,11 +63,12 @@ void test() {
// expected-error-re@*:* 0-1 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}}
// 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}}
// expected-error-re@*:* 0-1 {{call to deleted constructor of {{.*}}}}
- // expected-error-re@*:* {{union member {{.*}} has reference type {{.*}}}}
+ // expected-error-re@*:* 0-1 {{union member {{.*}} has reference type {{.*}}}}
e.transform_error(return_no_object<int&>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}}
// expected-error-re@*:* 0-1 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}}
// 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}}
+ // expected-warning-re@*:* 0-1 {{union member {{.*}} has reference type {{.*}}, which is a Microsoft extension}}
}
// Test const& overload
@@ -71,6 +78,7 @@ void test() {
// expected-error-re@*:* 0-1 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}}
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}}
// expected-error-re@*:* 0-1 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}}
+ // expected-error-re@*:* 0-1 {{call to deleted constructor of {{.*}}}}
}
// Test && overload
More information about the libcxx-commits
mailing list