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

lucdanton at free dot fr changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lucdanton at free dot fr

--- Comment #2 from lucdanton at free dot fr ---
As a workaround I thought about (ab)using the comma operator:

    return assert( cond ), expr;

The reasoning being that C guarantees that assert(…) is a void expression
(regardless of NDEBUG). This is rejected as well, although I’m not entirely
sure why. After a quick look at the preprocessed source, it appears GCC rejects
(‘body not a return statement’, again) functions of the form:

//------

void some_extern_func();

constexpr int foo(int i)
{ return (true ? static_cast<void>(0) : some_extern_func()), i; }

//-----

If the third leg of the conditional operator is e.g. throw whatever (a common
trick to ‘halt’ CTFE) everything behaves as expected.

Does this warrant opening another bug?

Reply via email to