public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/105457] New: error: '__builtin_huge_valq()' is not a constant expression
@ 2022-05-03 2:05 zhonghao at pku dot org.cn
2022-05-03 2:12 ` [Bug c++/105457] " pinskia at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: zhonghao at pku dot org.cn @ 2022-05-03 2:05 UTC (permalink / raw)
To: gcc-bugs
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?
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/105457] error: '__builtin_huge_valq()' is not a constant expression
2022-05-03 2:05 [Bug c++/105457] New: error: '__builtin_huge_valq()' is not a constant expression zhonghao at pku dot org.cn
@ 2022-05-03 2:12 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-05-03 2:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105457
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
__float128 is an extension and so is __builtin_huge_valq.
There is no bug. Many of gcc builtins are considered constant expressions.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-05-03 2:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-03 2:05 [Bug c++/105457] New: error: '__builtin_huge_valq()' is not a constant expression zhonghao at pku dot org.cn
2022-05-03 2:12 ` [Bug c++/105457] " pinskia at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).