Cleanup any_cast failure test

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300175 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Fiselier
2017-04-13 05:27:55 +00:00
parent e4b267b262
commit 0301092a7b

View File

@@ -25,13 +25,30 @@ using std::any_cast;
int main()
{
any a(1);
any_cast<int &>(&a); // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
any_cast<int &&>(&a); // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
any_cast<int const &>(&a); // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
any_cast<int const&&>(&a); // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
// expected-error@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."}}
any_cast<int &&>(&a); // expected-note {{requested here}}
// expected-error@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."}}
any_cast<int const&&>(&a); // expected-note {{requested here}}
any const& a2 = a;
any_cast<int &>(&a2); // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
any_cast<int &&>(&a2); // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
any_cast<int const &>(&a2); // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
any_cast<int const &&>(&a2); // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
// expected-error@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."}}
any_cast<int &&>(&a2); // expected-note {{requested here}}
// expected-error@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."}}
any_cast<int const &&>(&a2); // expected-note {{requested here}}
}