https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118038

            Bug ID: 118038
           Summary: constexpr std::bit_cast with long double/float80_t
                    does not work
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gero.peterhoff at gmx dot net
  Target Milestone: ---

int main()
{
        using From = unsigned __int128; //      uint128_t
        using To = long double;         //      float80_t

        static_assert(sizeof(To) == sizeof(From), "invalid");

        constexpr From
                //from = From{1} << 62; //      work
                //from = From{1} << 63; //      not work
                //from = From{1} << 64; //      not work
                from = From{1} << 78;   //      not work
                //from = From{1} << 79; //      work

        constexpr To
                t = std::bit_cast<To>(from);

        std::cout << t << std::endl;
}

cu
Gero

Reply via email to