public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96155] New: "throw" that is not executed in constexpr function fails to compile
@ 2020-07-10 15:11 r-gcc at mail dot uk
  2020-07-10 15:18 ` [Bug c++/96155] " mpolacek at gcc dot gnu.org
  2021-08-28 21:46 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: r-gcc at mail dot uk @ 2020-07-10 15:11 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96155
           Summary: "throw" that is not executed in constexpr function
                    fails to compile
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: r-gcc at mail dot uk
  Target Milestone: ---

This fails to compile on gcc trunk, while the same code compiles fine in clang:

constexpr bool foo()
{
    for(int i = 0; i != 5; ++i)
    {
        if(i == 3)
            return false;
    }
    throw 5;
    return true;
}


this is the message I am getting:

error: expression ‘<throw-expression>’ is not a constant expression

live example:

https://godbolt.org/z/eqqr4f

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

* [Bug c++/96155] "throw" that is not executed in constexpr function fails to compile
  2020-07-10 15:11 [Bug c++/96155] New: "throw" that is not executed in constexpr function fails to compile r-gcc at mail dot uk
@ 2020-07-10 15:18 ` mpolacek at gcc dot gnu.org
  2021-08-28 21:46 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-07-10 15:18 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
                 CC|                            |mpolacek at gcc dot gnu.org
   Last reconfirmed|                            |2020-07-10

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.  Doesn't look like a regression.

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

* [Bug c++/96155] "throw" that is not executed in constexpr function fails to compile
  2020-07-10 15:11 [Bug c++/96155] New: "throw" that is not executed in constexpr function fails to compile r-gcc at mail dot uk
  2020-07-10 15:18 ` [Bug c++/96155] " mpolacek at gcc dot gnu.org
@ 2021-08-28 21:46 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-28 21:46 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 98672.

*** This bug has been marked as a duplicate of bug 98672 ***

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

end of thread, other threads:[~2021-08-28 21:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-10 15:11 [Bug c++/96155] New: "throw" that is not executed in constexpr function fails to compile r-gcc at mail dot uk
2020-07-10 15:18 ` [Bug c++/96155] " mpolacek at gcc dot gnu.org
2021-08-28 21:46 ` 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).