brintos

brintos / llvm-project-archived public Read only

0
0
Text · 975 B · d1ec42e Raw
35 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// UNSUPPORTED: c++03, c++11, c++1410 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 21void test() {22  {23    const std::any ca = 1;24 25    // expected-error-re@any:* {{static assertion failed{{.*}}_ValueType may not be void.}}26    (void)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    (void)std::any_cast<void>(&a); // expected-note {{requested here}}33  }34}35