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:
@@ -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'}}
|
||||
|
||||
}
|
||||
|
||||
@@ -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'}}
|
||||
}
|
||||
|
||||
@@ -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."}}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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}}
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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}}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user