Fix failing -verify tests due to change in Clangs static_assert message.

Clang recently changed the way it outputs static assert diagnostics.
This patch fixes libc++'s -verify tests so they tolerate both the old
and new message format.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@313499 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Fiselier
2017-09-17 20:57:05 +00:00
parent ffe3715924
commit dfcb00a2c5
12 changed files with 41 additions and 41 deletions

View File

@@ -23,7 +23,7 @@ int main() {
using namespace fs;
using RIt = std::reverse_iterator<path::iterator>;
// expected-error@iterator:* {{static_assert failed "The specified iterator type cannot be used with reverse_iterator; Using stashing iterators with reverse_iterator causes undefined behavior"}}
// expected-error-re@iterator:* {{static_assert failed{{.*}} "The specified iterator type cannot be used with reverse_iterator; Using stashing iterators with reverse_iterator causes undefined behavior"}}
{
RIt r;
((void)r);

View File

@@ -36,7 +36,7 @@ int main() {
SPtr<2> s2(getFn<2>(), Deleter{}); // OK
SPtr<3> s3(nullptr, Deleter{}); // OK
}
// expected-error@memory:* 2 {{static_assert failed "default_delete cannot be instantiated for function types"}}
// expected-error-re@memory:* 2 {{static_assert failed{{.*}} "default_delete cannot be instantiated for function types"}}
{
SPtr<4> s4(getFn<4>()); // expected-note {{requested here}}
SPtr<5> s5(getFn<5>(), std::default_delete<FnType<5>>{}); // expected-note {{requested here}}

View File

@@ -22,7 +22,7 @@
int main() {
std::allocator<void> alloc;
// expected-error@tuple:* 4 {{static_assert failed "Attempted to construct a reference element in a tuple with an rvalue"}}
// expected-error-re@tuple:* 4 {{static_assert failed{{.*}} "Attempted to construct a reference element in a tuple with an rvalue"}}
// bind lvalue to rvalue
std::tuple<int const&> t(42); // expected-note {{requested here}}

View File

@@ -32,7 +32,7 @@ int main()
using namespace std::experimental;
non_copyable nc;
any a;
a = static_cast<non_copyable &&>(nc); // expected-error@experimental/any:* 2 {{static_assert failed "_ValueType must be CopyConstructible."}}
a = static_cast<non_copyable &&>(nc); // expected-error-re@experimental/any:* 2 {{static_assert failed{{.*}} "_ValueType must be CopyConstructible."}}
// expected-error@experimental/any:* {{calling a private constructor of class 'non_copyable'}}
}

View File

@@ -31,6 +31,6 @@ int main()
using namespace std::experimental;
non_copyable nc;
any a(static_cast<non_copyable &&>(nc));
// expected-error@experimental/any:* 1 {{static_assert failed "_ValueType must be CopyConstructible."}}
// expected-error-re@experimental/any:* 1 {{static_assert failed{{.*}} "_ValueType must be CopyConstructible."}}
// expected-error@experimental/any:* 1 {{calling a private constructor of class 'non_copyable'}}
}

View File

@@ -25,13 +25,13 @@ using std::experimental::any_cast;
int main()
{
any a(1);
any_cast<int &>(&a); // expected-error@experimental/any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
any_cast<int &&>(&a); // expected-error@experimental/any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
any_cast<int const &>(&a); // expected-error@experimental/any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
any_cast<int const&&>(&a); // expected-error@experimental/any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
any_cast<int &>(&a); // expected-error-re@experimental/any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}}
any_cast<int &&>(&a); // expected-error-re@experimental/any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}}
any_cast<int const &>(&a); // expected-error-re@experimental/any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}}
any_cast<int const&&>(&a); // expected-error-re@experimental/any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}}
any const& a2 = a;
any_cast<int &>(&a2); // expected-error@experimental/any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
any_cast<int &&>(&a2); // expected-error@experimental/any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
any_cast<int const &>(&a2); // expected-error@experimental/any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
any_cast<int const &&>(&a2); // expected-error@experimental/any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
any_cast<int &>(&a2); // expected-error-re@experimental/any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}}
any_cast<int &&>(&a2); // expected-error-re@experimental/any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}}
any_cast<int const &>(&a2); // expected-error-re@experimental/any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}}
any_cast<int const &&>(&a2); // expected-error-re@experimental/any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}}
}

View File

@@ -25,12 +25,12 @@ using std::any_cast;
void test_const_lvalue_cast_request_non_const_lvalue()
{
const any a;
// expected-error@any:* {{static_assert failed "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
// expected-error-re@any:* {{static_assert failed{{.*}} "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
// expected-error@any:* {{binding value of type 'const TestType' to reference to type 'TestType' drops 'const' qualifier}}
any_cast<TestType &>(a); // expected-note {{requested here}}
const any a2(42);
// expected-error@any:* {{static_assert failed "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
// expected-error-re@any:* {{static_assert failed{{.*}} "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
// expected-error@any:* {{binding value of type 'const int' to reference to type 'int' drops 'const' qualifier}}
any_cast<int&>(a2); // expected-note {{requested here}}
}
@@ -38,22 +38,22 @@ void test_const_lvalue_cast_request_non_const_lvalue()
void test_lvalue_any_cast_request_rvalue()
{
any a;
// expected-error@any:* {{static_assert failed "ValueType is required to be an lvalue reference or a CopyConstructible type"}}
// expected-error-re@any:* {{static_assert failed{{.*}} "ValueType is required to be an lvalue reference or a CopyConstructible type"}}
any_cast<TestType &&>(a); // expected-note {{requested here}}
any a2(42);
// expected-error@any:* {{static_assert failed "ValueType is required to be an lvalue reference or a CopyConstructible type"}}
// expected-error-re@any:* {{static_assert failed{{.*}} "ValueType is required to be an lvalue reference or a CopyConstructible type"}}
any_cast<int&&>(a2); // expected-note {{requested here}}
}
void test_rvalue_any_cast_request_lvalue()
{
any a;
// expected-error@any:* {{static_assert failed "ValueType is required to be an rvalue reference or a CopyConstructible type"}}
// expected-error-re@any:* {{static_assert failed{{.*}} "ValueType is required to be an rvalue reference or a CopyConstructible type"}}
// expected-error@any:* {{non-const lvalue reference to type 'TestType' cannot bind to a temporary}}
any_cast<TestType &>(std::move(a)); // expected-note {{requested here}}
// expected-error@any:* {{static_assert failed "ValueType is required to be an rvalue reference or a CopyConstructible type"}}
// expected-error-re@any:* {{static_assert failed{{.*}} "ValueType is required to be an rvalue reference or a CopyConstructible type"}}
// expected-error@any:* {{non-const lvalue reference to type 'int' cannot bind to a temporary}}
any_cast<int&>(42);
}

View File

@@ -29,18 +29,18 @@ int main()
any a;
// expected-error@any:* {{binding value of type 'const TestType' to reference to type 'TestType' drops 'const' qualifier}}
// expected-error@any:* {{static_assert failed "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
// expected-error-re@any:* {{static_assert failed {{.*}} "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
any_cast<TestType &>(static_cast<any const&>(a)); // expected-note {{requested here}}
// expected-error@any:* {{cannot cast from lvalue of type 'const TestType' to rvalue reference type 'TestType &&'; types are not compatible}}
// expected-error@any:* {{static_assert failed "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
// expected-error-re@any:* {{static_assert failed {{.*}} "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
any_cast<TestType &&>(static_cast<any const&>(a)); // expected-note {{requested here}}
// expected-error@any:* {{binding value of type 'const TestType2' to reference to type 'TestType2' drops 'const' qualifier}}
// expected-error@any:* {{static_assert failed "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
// expected-error-re@any:* {{static_assert failed {{.*}} "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
any_cast<TestType2 &>(static_cast<any const&&>(a)); // expected-note {{requested here}}
// expected-error@any:* {{cannot cast from lvalue of type 'const TestType2' to rvalue reference type 'TestType2 &&'; types are not compatible}}
// expected-error@any:* {{static_assert failed "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
// expected-error-re@any:* {{static_assert failed {{.*}} "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
any_cast<TestType2 &&>(static_cast<any const&&>(a)); // expected-note {{requested here}}
}

View File

@@ -42,17 +42,17 @@ struct no_move {
int main() {
any a;
// expected-error@any:* {{static_assert failed "ValueType is required to be an lvalue reference or a CopyConstructible type"}}
// expected-error-re@any:* {{static_assert failed{{.*}} "ValueType is required to be an lvalue reference or a CopyConstructible type"}}
// expected-error@any:* {{static_cast from 'no_copy' to 'no_copy' uses deleted function}}
any_cast<no_copy>(static_cast<any&>(a)); // expected-note {{requested here}}
// expected-error@any:* {{static_assert failed "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
// expected-error-re@any:* {{static_assert failed{{.*}} "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
// expected-error@any:* {{static_cast from 'const no_copy' to 'no_copy' uses deleted function}}
any_cast<no_copy>(static_cast<any const&>(a)); // expected-note {{requested here}}
any_cast<no_copy>(static_cast<any &&>(a)); // OK
// expected-error@any:* {{static_assert failed "ValueType is required to be an rvalue reference or a CopyConstructible type"}}
// expected-error-re@any:* {{static_assert failed{{.*}} "ValueType is required to be an rvalue reference or a CopyConstructible type"}}
// expected-error@any:* {{static_cast from 'typename remove_reference<no_move &>::type' (aka 'no_move') to 'no_move' uses deleted function}}
any_cast<no_move>(static_cast<any &&>(a));
}

View File

@@ -26,29 +26,29 @@ int main()
{
any a(1);
// expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
// expected-error-re@any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}}
any_cast<int &>(&a); // expected-note {{requested here}}
// expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
// expected-error-re@any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}}
any_cast<int &&>(&a); // expected-note {{requested here}}
// expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
// expected-error-re@any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}}
any_cast<int const &>(&a); // expected-note {{requested here}}
// expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
// expected-error-re@any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}}
any_cast<int const&&>(&a); // expected-note {{requested here}}
any const& a2 = a;
// expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
// expected-error-re@any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}}
any_cast<int &>(&a2); // expected-note {{requested here}}
// expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
// expected-error-re@any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}}
any_cast<int &&>(&a2); // expected-note {{requested here}}
// expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
// expected-error-re@any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}}
any_cast<int const &>(&a2); // expected-note {{requested here}}
// expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
// expected-error-re@any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}}
any_cast<int const &&>(&a2); // expected-note {{requested here}}
}

View File

@@ -26,22 +26,22 @@ int main()
{
using std::optional;
{
// expected-error@optional:* 2 {{static_assert failed "instantiation of optional with a reference type is ill-formed}}
// expected-error-re@optional:* 2 {{static_assert failed{{.*}} "instantiation of optional with a reference type is ill-formed}}
optional<int&> opt1;
optional<int&&> opt2;
}
{
// expected-error@optional:* {{static_assert failed "instantiation of optional with a non-destructible type is ill-formed"}}
// expected-error-re@optional:* {{static_assert failed{{.*}} "instantiation of optional with a non-destructible type is ill-formed"}}
optional<X> opt3;
}
{
// expected-error@optional:* {{static_assert failed "instantiation of optional with a non-object type is undefined behavior"}}
// expected-error@optional:* {{static_assert failed "instantiation of optional with a non-destructible type is ill-formed}}
// expected-error-re@optional:* {{static_assert failed{{.*}} "instantiation of optional with a non-object type is undefined behavior"}}
// expected-error-re@optional:* {{static_assert failed{{.*}} "instantiation of optional with a non-destructible type is ill-formed}}
optional<void()> opt4;
}
{
// expected-error@optional:* {{static_assert failed "instantiation of optional with a non-object type is undefined behavior"}}
// expected-error@optional:* {{static_assert failed "instantiation of optional with a non-destructible type is ill-formed}}
// expected-error-re@optional:* {{static_assert failed{{.*}} "instantiation of optional with a non-object type is undefined behavior"}}
// expected-error-re@optional:* {{static_assert failed{{.*}} "instantiation of optional with a non-destructible type is ill-formed}}
// expected-error@optional:* 1+ {{cannot form a reference to 'void'}}
optional<const void> opt4;
}

View File

@@ -25,7 +25,7 @@ int main()
#if TEST_STD_VER >= 11
{
std::forward<A&>(source()); // expected-note {{requested here}}
// expected-error@type_traits:* 1 {{static_assert failed "can not forward an rvalue as an lvalue"}}
// expected-error-re@type_traits:* 1 {{static_assert failed {{.*}} "can not forward an rvalue as an lvalue"}}
}
#else
{