// { dg-do run { target c++17 } }
// { dg-options "-Wno-init-list-lifetime" }
// Copyright (C) 2020-2023 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// .
#include
#include
#include
#include
void
test01()
{
auto a = std::any(std::in_place_type, 5);
VERIFY( std::any_cast(std::any_cast(a)) == 5 );
auto b = std::any(std::in_place_type, {1});
(void) std::any_cast>(std::any_cast(b));
}
void
test02()
{
std::any p = std::pair(1, 1);
auto pt = std::any_cast>(p);
VERIFY( std::any_cast(pt.first) == 1 );
VERIFY( std::any_cast(pt.second) == 1 );
std::any t = std::tuple(1);
auto tt = std::any_cast>(t);
VERIFY( std::any_cast(std::get<0>(tt)) == 1 );
}
int main()
{
test01();
test02();
}