[Bug c++/93769] Slightly wrong error message for static_asserts with no message

mpolacek at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Feb 18 23:10:00 GMT 2020


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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
(In reply to Gennaro Prota from comment #0)
> Compiling with -std=c++14 --pedantic, the following translation unit:
> 
>   static_assert(true);
> 
>   int
>   main()
>   {
>   }
> 
> yields:
> 
> <source>:1:15: warning: static_assert without a message only available with
> '-std=c++17' or '-std=gnu++17' [-Wpedantic]
> 
> This is not true, because the compiler accepts it even with -std=c++11 or
> -std=c++14.

Not with -pedantic-errors.

> Assuming this is intentional (but, if not, the message would still need
> tweaking: e.g. it will be accepted with std=c++20, as well), I suggest to
> reword the error message to:
> 
>   static_assert without a message is non-standard before C++17

-std=c++20 implies -std=c++17.  I suppose we could say what you're suggesting
but there are many places that would need changing.  I'm dubious if it's worth
it.


More information about the Gcc-bugs mailing list