[Bug c++/105457] New: error: '__builtin_huge_valq()' is not a constant expression

zhonghao at pku dot org.cn gcc-bugzilla@gcc.gnu.org
Tue May 3 02:05:05 GMT 2022


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

            Bug ID: 105457
           Summary: error: '__builtin_huge_valq()' is not a constant
                    expression
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zhonghao at pku dot org.cn
  Target Milestone: ---

The code is as follows:

template <class>
struct infinity{};

template <> struct infinity<__float128> { static constexpr __float128 value =
__builtin_huge_valq(); };

int main() {
    auto x = infinity<__float128>::value;
}

GCC 7.1+ accepts this code, but GCC 6.4 rejects it. I tried clang and other
compilers. They all reject the code:https://godbolt.org/z/qWb5oe4dx

The above code comes from kokkos:

https://github.com/mosra/corrade/commit/59823941093bee9f99e5a63cb4218b53a7bd5495

Look like a gcc bug?


More information about the Gcc-bugs mailing list