Lines Matching defs:TO

1734 template <typename TO, typename FROM>
1735 common::IfNoLvalue<std::optional<TO>, FROM> ConvertString(FROM &&s) {
1736 if constexpr (std::is_same_v<TO, FROM>) {
1737 return std::make_optional<TO>(std::move(s));
1741 TO str;
1748 return std::make_optional<TO>(std::move(str));
1752 template <typename TO, TypeCategory FROMCAT>
1753 Expr<TO> FoldOperation(
1754 FoldingContext &context, Convert<TO, FROMCAT> &&convert) {
1760 Convert<TO, FROMCAT> &convert;
1763 [&msvcWorkaround](auto &kindExpr) -> Expr<TO> {
1772 if constexpr (TO::category == TypeCategory::Integer) {
1774 auto converted{Scalar<TO>::ConvertSigned(*value)};
1780 value->SignedDecimal(), Operand::kind, TO::kind,
1785 auto converted{Scalar<TO>::ConvertUnsigned(*value)};
1791 value->UnsignedDecimal(), Operand::kind, TO::kind,
1796 auto converted{value->template ToInteger<Scalar<TO>>()};
1802 Operand::kind, TO::kind);
1806 Operand::kind, TO::kind);
1811 } else if constexpr (TO::category == TypeCategory::Unsigned) {
1814 return Expr<TO>{
1815 Constant<TO>{Scalar<TO>::ConvertUnsigned(*value).value}};
1817 return Expr<TO>{
1818 Constant<TO>{value->template ToInteger<Scalar<TO>>().value}};
1820 } else if constexpr (TO::category == TypeCategory::Real) {
1823 auto converted{Scalar<TO>::FromInteger(
1829 TO::kind);
1834 auto converted{Scalar<TO>::Convert(*value)};
1838 "REAL(%d) to REAL(%d) conversion", Operand::kind, TO::kind);
1846 } else if constexpr (TO::category == TypeCategory::Complex) {
1849 ComplexConstructor<TO::kind>{
1850 AsExpr(Convert<typename TO::Part>{AsCategoryExpr(
1852 AsExpr(Convert<typename TO::Part>{AsCategoryExpr(
1855 } else if constexpr (TO::category == TypeCategory::Character &&
1857 if (auto converted{ConvertString<Scalar<TO>>(std::move(*value))}) {
1860 } else if constexpr (TO::category == TypeCategory::Logical &&
1862 return Expr<TO>{value->IsTrue()};
1864 } else if constexpr (TO::category == FromCat &&
1867 if constexpr (std::is_same_v<Operand, TO>) {
1869 } else if constexpr (TO::category == TypeCategory::Logical ||
1870 TO::category == TypeCategory::Integer) {
1872 std::get_if<Convert<Operand, TO::category>>(&kindExpr.u)}) {
1874 if (auto *x{std::get_if<Expr<TO>>(&innerConv->left().u)}) {
1875 if constexpr (TO::category == TypeCategory::Logical ||
1876 TO::kind <= Operand::kind) {
1879 } else if constexpr (std::is_same_v<TO,
1891 return Expr<TO>{std::move(convert)};