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

Thomas P. K. Healy <thomaspkhealy at yahoo dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |thomaspkhealy at yahoo dot com

--- Comment #8 from Thomas P. K. Healy <thomaspkhealy at yahoo dot com> ---
Here's my opinion on how the diagnostics should be worded. I've taken a look at
existing diagnostic messages and have worded these similarly:

Scenario No. 1: The use of 'assert' is invalid because the argument given to it
is not usable at compile time. Here's an example:
unsigned n = 3u;
consteval int Func1(unsigned const arg)
{
    assert( (arg + n) > 5u );
    return 0; 
}
Suggested Error Text: Assertion is not possible because its argument is not
usable in a consteval context: 'n' has unknown value

Scenario No. 2: The use of 'assert' is valid, i.e. its argument is known at
compile time, however the assertion evaluated to false. Here's an example:
consteval int Func2(unsigned const arg)
{
    assert( (arg & 1u) && !(arg % 2) );
    return 0;
}
Suggested Error Text: Assertion `(arg & 1u) && !(arg % 2)' failed in consteval
context

Reply via email to