11#ifndef FORTRAN_RUNTIME_CPP_TYPE_H_
12#define FORTRAN_RUNTIME_CPP_TYPE_H_
14#include "flang/Common/Fortran-consts.h"
15#include "flang/Common/float128.h"
16#include "flang/Common/float80.h"
17#include "flang/Common/uint128.h"
18#include "flang/Runtime/complex.h"
20#if __cplusplus >= 202302
25#if !defined HAS_FP16 && __STDCPP_FLOAT16_T__
28#if !defined HAS_BF16 && __STDCPP_BFLOAT16_T__
32namespace Fortran::runtime {
34using common::TypeCategory;
39template <TypeCategory CAT,
int KIND>
40using CppTypeFor =
typename CppTypeForHelper<CAT, KIND>::type;
42template <TypeCategory CAT,
int KIND>
43constexpr bool HasCppTypeFor{
44 !std::is_void_v<typename CppTypeForHelper<CAT, KIND>::type>};
47 using type = common::HostSignedIntType<8 * KIND>;
51 using type = common::HostUnsignedIntType<8 * KIND>;
56 using type = std::float16_t;
60template <>
struct CppTypeForHelper<TypeCategory::Real, 3> {
61 using type = std::bfloat16_t;
65#if __STDCPP_FLOAT32_T__
66 using type = std::float32_t;
72#if __STDCPP_FLOAT64_T__
73 using type = std::float64_t;
80 using type = CppFloat80Type;
83#if __STDCPP_FLOAT128_T__
84using CppFloat128Type = std::float128_t;
86using CppFloat128Type =
long double;
88using CppFloat128Type = __float128;
90#if __STDCPP_FLOAT128_t || HAS_LDBL128 || HAS_FLOAT128
91template <>
struct CppTypeForHelper<TypeCategory::Real, 16> {
92 using type = CppFloat128Type;
97 using type = rtcmplx::complex<CppTypeFor<TypeCategory::Real, KIND>>;
104 using type = char16_t;
107 using type = char32_t;
111 using type = common::HostSignedIntType<8 * KIND>;
Definition: cpp-type.h:36