https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127615
Bug ID: 127615
Summary: Constexpr function calls in C
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: aaron at aaronballman dot com
Target Milestone: ---
GCC currently accepts the following in C23 mode:
```
#include <math.h>
constexpr float f = sinf(0.0f);
```
with a pedantic warning that the initializer is not a constant expression:
https://godbolt.org/z/KWx4fWTnP
C allows implementations to extend what is a constant expression, so this is
allowed per the standard. However, was accepting this in GCC an intentional
decision given that C has no notion of constexpr function calls? Or was it more
of an accident as part of the C++23 constexpr cmath work?
(Worth noting: if WG14 were to get constexpr function calls as part of the
language, would they also want the C++ restriction that implementations are not
allowed to add constexpr to standard library functions unless explicitly
required by the standard: https://eel.is/c++draft/constexpr.functions#1 ? If
so, that could get awkward if implementations already implicitly add constexpr
but the standard library doesn't have the markings.)