[Bug c++/59329] New: Using `assert(...)` is not allowed in constexpr functions
vittorio.romeo at outlook dot com
gcc-bugzilla@gcc.gnu.org
Thu Nov 28 11:17:00 GMT 2013
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?
More information about the Gcc-bugs
mailing list