public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/81157] If constexpr does not support Short-circuit evaluation
       [not found] <bug-81157-4@http.gcc.gnu.org/bugzilla/>
@ 2021-09-20 21:19 ` arthur.j.odwyer at gmail dot com
  2021-09-21 17:56 ` ppalka at gcc dot gnu.org
  1 sibling, 0 replies; 2+ messages in thread
From: arthur.j.odwyer at gmail dot com @ 2021-09-20 21:19 UTC (permalink / raw)
  To: gcc-bugs

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

Arthur O'Dwyer <arthur.j.odwyer at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |arthur.j.odwyer at gmail dot com

--- Comment #1 from Arthur O'Dwyer <arthur.j.odwyer at gmail dot com> ---
I'd say neither a bug nor a defect. In `if constexpr (X && Y)`, `X && Y` is an
expression and it must be well-formed, even if it's false -- just like if you
did `static_assert((X && Y) == false)`. GCC is behaving according to the C++
Standard in this case.

Recommend closing as INVALID.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/81157] If constexpr does not support Short-circuit evaluation
       [not found] <bug-81157-4@http.gcc.gnu.org/bugzilla/>
  2021-09-20 21:19 ` [Bug c++/81157] If constexpr does not support Short-circuit evaluation arthur.j.odwyer at gmail dot com
@ 2021-09-21 17:56 ` ppalka at gcc dot gnu.org
  1 sibling, 0 replies; 2+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-09-21 17:56 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |ppalka at gcc dot gnu.org
         Resolution|---                         |INVALID

--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Agreed.

If you need short-circuiting evaluation inside a constexpr if, just encode the
condition as a nested-requirement:

  if constexpr (requires { requires IsContainer<V> && Same<typename
V::innerType, int>; })
    ...

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-21 17:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-81157-4@http.gcc.gnu.org/bugzilla/>
2021-09-20 21:19 ` [Bug c++/81157] If constexpr does not support Short-circuit evaluation arthur.j.odwyer at gmail dot com
2021-09-21 17:56 ` ppalka 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).