https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80783
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic
Status|UNCONFIRMED |NEW
Last reconfirmed| |2017-05-18
CC| |msebor at gcc dot gnu.org
Summary|Inconsistent constexpr |missing constexpr
|diagnostic for some cstdlib |diagnostic for functions
|functions |that cannot be constexpr
Ever confirmed|0 |1
Severity|normal |enhancement
--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
GCC doesn't diagnose constexpr functions that cannot be invoked without
violating the core constant expression constraint. So in the first case:
constexpr size_t f() { exit(0); return 1; }
the function cannot be invoked in a constexpr context but could be called
elsewhere. As QoI, GCC could diagnose it but isn't required to and doesn't. I
agree that it would be a useful enhancement to add a diagnostic for it like
Clang's -Winvalid-constexpr so I'll confirm this as a request for one.
The nonstandard signature warning is about the incorrect/invalid declarations
of the standard functions and is unrelated to constexpr.