40 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++14, c++17, c++20, c++2310 11// <complex>12 13// template<class T> struct tuple_size;14 15#include <cassert>16#include <complex>17#include <concepts>18 19template <typename C>20concept HasTupleSize = requires { std::tuple_size<C>{}; };21 22struct SomeObject {};23 24static_assert(!HasTupleSize<SomeObject>);25 26template <typename T>27void test() {28 using C = std::complex<T>;29 30 static_assert(HasTupleSize<C>);31 static_assert(std::same_as<typename std::tuple_size<C>::value_type, std::size_t>);32 static_assert(std::tuple_size<C>() == 2);33}34 35void test() {36 test<float>();37 test<double>();38 test<long double>();39}40