https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121811
Bug ID: 121811
Summary: stdckdint.h fails to compile in C++26 mode in GCC 14
Product: gcc
Version: 14.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: thiago at kde dot org
Target Milestone: ---
Filing against the "c" component because the issue is the C header in
gcc/ginclude/stdckdint.h.
The following code:
#include <stdckdint.h>
int main(int argc, char **argv)
{
#ifdef __STDC_VERSION_STDCKDINT_H__
int r;
return ckd_add(&r, argc, 1) ? r : 0;
#endif
}
Compiles in C++26 mode with GCC 15, but fails with GCC 14 due to the use of
_Bool.
/tmp/test.cpp:6:12: error: ‘_Bool’ was not declared in this scope
6 | return ckd_add(&r, argc, 1) ? r : 0;
| ^~~~~~~
/tmp/test.cpp:6:12: error: expected ‘)’ before ‘__builtin_add_overflow’
6 | return ckd_add(&r, argc, 1) ? r : 0;
| ^~~~~~~
See https://godbolt.org/z/Koh9cEY5b
With the LLVM components:
* Clang + libc++: works, as Clang's <stdckdint.h> works in C and C++
* Clang + libstdc++ 15: works, with libstdc++'s new <stdckdint.h>
* Clang + libstdc++ 14: fails
* GCC + libc++: fails, because it uses the failing C header
Please fix and backport to the 14 branch.