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?

Reply via email to