public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/59329] New: Using `assert(...)` is not allowed in constexpr functions
@ 2013-11-28 11:17 vittorio.romeo at outlook dot com
  2013-12-02 14:04 ` [Bug c++/59329] " daniel.kruegler at googlemail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: vittorio.romeo at outlook dot com @ 2013-11-28 11:17 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59329

            Bug ID: 59329
           Summary: Using `assert(...)` is not allowed in constexpr
                    functions
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: trivial
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vittorio.romeo at outlook dot com

inline constexpr int exampleFunction(int min, int max)
{
    assert(min <= max);
    return min + max;
}

The above function fails to compile, because of the `assert(min <= max)`. 

g++ reports that a constexpr function may only be composed of a simple return
statement.

clang++ compiles the function successfully.



Is it possible to lift this restriction?


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

end of thread, other threads:[~2015-03-27 17:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-28 11:17 [Bug c++/59329] New: Using `assert(...)` is not allowed in constexpr functions vittorio.romeo at outlook dot com
2013-12-02 14:04 ` [Bug c++/59329] " daniel.kruegler at googlemail dot com
2014-01-23 17:13 ` lucdanton at free dot fr
2014-05-08 21:18 ` jason at gcc dot gnu.org
2015-03-27 17:36 ` paolo.carlini at oracle dot com
2015-03-27 17:40 ` paolo at gcc dot gnu.org
2015-03-27 17:41 ` paolo.carlini at oracle dot com

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).