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, c++17, c++20, c++23
10
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, 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

source code of libcxx/test/std/numerics/complex.number/complex.tuple/tuple_size.compile.pass.cpp