| 1 |
//===----------------------------------------------------------------------===// |
| 2 |
// |
| 3 |
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 |
// See https://llvm.org/LICENSE.txt for license information. |
| 5 |
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 |
// |
| 7 |
//===----------------------------------------------------------------------===// |
| 8 |
|
| 9 |
// UNSUPPORTED: c++03, c++11, c++14 |
| 10 |
|
| 11 |
// <any> |
| 12 |
|
| 13 |
// template<class T> |
| 14 |
// const T* any_cast(const any* operand) noexcept; |
| 15 |
|
| 16 |
// template<class T> |
| 17 |
// T* any_cast(any* operand) noexcept; |
| 18 |
|
| 19 |
#include <any> |
| 20 |
|
| 21 |
void test() { |
| 22 |
{ |
| 23 |
const std::any ca = 1; |
| 24 |
|
| 25 |
// expected-error-re@any:* {{static assertion failed{{.*}}_ValueType may not be void.}} |
| 26 |
std::any_cast<void>(&ca); // expected-note {{requested here}} |
| 27 |
} |
| 28 |
{ |
| 29 |
std::any a = 1; |
| 30 |
|
| 31 |
// expected-error-re@any:* {{static assertion failed{{.*}}_ValueType may not be void.}} |
| 32 |
std::any_cast<void>(&a); // expected-note {{requested here}} |
| 33 |
} |
| 34 |
} |