public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/67371] New: Never executed "throw" in constexpr function fails to compile
@ 2015-08-27 13:26 ldionne.2 at gmail dot com
  2015-08-27 22:52 ` [Bug c++/67371] " ldionne.2 at gmail dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: ldionne.2 at gmail dot com @ 2015-08-27 13:26 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 67371
           Summary: Never executed "throw" in constexpr function fails to
                    compile
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ldionne.2 at gmail dot com
  Target Milestone: ---

The following code fails to compile on GCC trunk:

    constexpr void f() {
        if (false)
            throw;
    }


The error is:

    [snip]: In function 'constexpr void f()':
    [snip]: error: expression '<throw-expression>' is not a constant-expression
     }
     ^


The code should compile because the throw expression is never executed inside a
constexpr context. Clang indeed compiles this just fine.

Live example: http://melpon.org/wandbox/permlink/V0g96xpWdO2eWGNx


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

end of thread, other threads:[~2015-08-29 18:55 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-27 13:26 [Bug c++/67371] New: Never executed "throw" in constexpr function fails to compile ldionne.2 at gmail dot com
2015-08-27 22:52 ` [Bug c++/67371] " ldionne.2 at gmail dot com
2015-08-28  5:30 ` trippels at gcc dot gnu.org
2015-08-28  5:32 ` trippels at gcc dot gnu.org
2015-08-28  8:43 ` trippels at gcc dot gnu.org
2015-08-28  8:57 ` miyuki at gcc dot gnu.org
2015-08-28  9:37 ` trippels at gcc dot gnu.org
2015-08-28 10:06 ` Casey at Carter dot net
2015-08-29 18:52 ` trippels at gcc dot gnu.org
2015-08-29 18:55 ` trippels 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).