public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/101795] New: (x > QNaNf) is not a constant expression @ 2021-08-05 22:08 jonas.rahlf.basf at gmail dot com 2021-08-06 14:34 ` [Bug c++/101795] " glisse at gcc dot gnu.org ` (3 more replies) 0 siblings, 4 replies; 5+ messages in thread From: jonas.rahlf.basf at gmail dot com @ 2021-08-05 22:08 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101795 Bug ID: 101795 Summary: (x > QNaNf) is not a constant expression Product: gcc Version: 11.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jonas.rahlf.basf at gmail dot com Target Milestone: --- Somehow (x > QNaNf) is not a constant expression, according to g++. I could not find anything in the c++ standard that would support this behaviour. Both clang and MSVC compile (x > QNaNf) as a constant expression. Interestingly, (x == QNaNf) seems to work fine with g++. Example: #include <limits> constexpr bool canCompile = std::numeric_limits<float>::quiet_NaN() > 1; Compiler output: error: '(+QNaNf > 1.0e+0f)' is not a constant expression See also: https://godbolt.org/z/vW651jPYh No extra compile options needed. I noticed this when attempting to compile std::lerp(a,b,NaN) (which is supposed to be constexpr) as a constant expression. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/101795] (x > QNaNf) is not a constant expression 2021-08-05 22:08 [Bug c++/101795] New: (x > QNaNf) is not a constant expression jonas.rahlf.basf at gmail dot com @ 2021-08-06 14:34 ` glisse at gcc dot gnu.org 2022-12-25 7:21 ` pinskia at gcc dot gnu.org ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: glisse at gcc dot gnu.org @ 2021-08-06 14:34 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101795 --- Comment #1 from Marc Glisse <glisse at gcc dot gnu.org> --- Hint: -fno-trapping-math lets it compile. It should probably be accepted in a manifestly_const_eval context, although some in the committee wanted to prevent the use of NaN (and sometimes even infinity!) in constant expressions... ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/101795] (x > QNaNf) is not a constant expression 2021-08-05 22:08 [Bug c++/101795] New: (x > QNaNf) is not a constant expression jonas.rahlf.basf at gmail dot com 2021-08-06 14:34 ` [Bug c++/101795] " glisse at gcc dot gnu.org @ 2022-12-25 7:21 ` pinskia at gcc dot gnu.org 2022-12-27 11:57 ` marxin at gcc dot gnu.org 2022-12-28 19:14 ` pinskia at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: pinskia at gcc dot gnu.org @ 2022-12-25 7:21 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101795 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |needs-bisection --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Seems to be fixed in GCC 12+. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/101795] (x > QNaNf) is not a constant expression 2021-08-05 22:08 [Bug c++/101795] New: (x > QNaNf) is not a constant expression jonas.rahlf.basf at gmail dot com 2021-08-06 14:34 ` [Bug c++/101795] " glisse at gcc dot gnu.org 2022-12-25 7:21 ` pinskia at gcc dot gnu.org @ 2022-12-27 11:57 ` marxin at gcc dot gnu.org 2022-12-28 19:14 ` pinskia at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: marxin at gcc dot gnu.org @ 2022-12-27 11:57 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101795 Martin Liška <marxin at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |sayle at gcc dot gnu.org Keywords|needs-bisection | --- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> --- Fixed since r12-3660-ge9e46864cd0695d2. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/101795] (x > QNaNf) is not a constant expression 2021-08-05 22:08 [Bug c++/101795] New: (x > QNaNf) is not a constant expression jonas.rahlf.basf at gmail dot com ` (2 preceding siblings ...) 2022-12-27 11:57 ` marxin at gcc dot gnu.org @ 2022-12-28 19:14 ` pinskia at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: pinskia at gcc dot gnu.org @ 2022-12-28 19:14 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101795 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |DUPLICATE Status|UNCONFIRMED |RESOLVED --- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Dup of bug 88173. *** This bug has been marked as a duplicate of bug 88173 *** ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-12-28 19:14 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-08-05 22:08 [Bug c++/101795] New: (x > QNaNf) is not a constant expression jonas.rahlf.basf at gmail dot com 2021-08-06 14:34 ` [Bug c++/101795] " glisse at gcc dot gnu.org 2022-12-25 7:21 ` pinskia at gcc dot gnu.org 2022-12-27 11:57 ` marxin at gcc dot gnu.org 2022-12-28 19:14 ` 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).