[Bug 290299] C++26's <stdckdint.h> fails to compile in C++

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 16 Oct 2025 17:23:23 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=290299

            Bug ID: 290299
           Summary: C++26's <stdckdint.h> fails to compile in C++
           Product: Base System
           Version: 14.3-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: standards
          Assignee: standards@FreeBSD.org
          Reporter: thiago@kde.org

14.3's /usr/lib/clang/19/include/stdckdint.h has:

/* If we're hosted, fall back to the system's stdckdint.h. FreeBSD, for
 * example, already has a Clang-compatible stdckdint.h header.
 *
 * The `stdckdint.h` header requires C 23 or newer.
 */
#if __STDC_HOSTED__ && __has_include_next(<stdckdint.h>)
#include_next <stdckdint.h>
#else

But /usr/include/stdckdint.h is unusable in C++ mode, despite being part of
C++26.

See also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121811 for a similar
discussion.

$ cat /tmp/test.cpp
#include <stdckdint.h>
bool qAddOverflow(int v1, int v2, int *r)
{
    return ckd_add(r, v1, v2);
}
$ c++ -fsyntax-only -std=c++26 /tmp/test.cpp 
/tmp/test.cpp:4:12: error: use of undeclared identifier '_Bool'
    4 |     return ckd_add(r, v1, v2);
      |            ^
/usr/include/stdckdint.h:16:3: note: expanded from macro 'ckd_add'
   16 |         (_Bool)__builtin_add_overflow((a), (b), (result))
      |          ^
1 error generated.

-- 
You are receiving this mail because:
You are the assignee for the bug.