Bug 32138 - /usr/include/sys/platform/x86.h _Bool is incompatible with C++
Summary: /usr/include/sys/platform/x86.h _Bool is incompatible with C++
Status: NEW
Alias: None
Product: glibc
Classification: Unclassified
Component: build (show other bugs)
Version: 2.39
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-09-03 13:50 UTC by Jan Kratochvil
Modified: 2024-09-04 06:01 UTC (History)
3 users (show)

See Also:
Host:
Target: x86_64-linux
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Kratochvil 2024-09-03 13:50:34 UTC
FAIL:
$ echo '#include <sys/platform/x86.h>'|clang++ -std=c++11 -c -x c++ -
In file included from <stdin>:1:
In file included from /usr/include/sys/platform/x86.h:25:
/usr/include/bits/platform/features.h:31:19: error: unknown type name '_Bool'
   31 | static __inline__ _Bool
      |                   ^
In file included from <stdin>:1:
/usr/include/sys/platform/x86.h:33:19: error: unknown type name '_Bool'
   33 | static __inline__ _Bool
      |                   ^
/usr/include/sys/platform/x86.h:46:19: error: unknown type name '_Bool'
   46 | static __inline__ _Bool
      |                   ^
3 errors generated.

PASS:
$ echo '#include <sys/platform/x86.h>'|g++ -std=c++11 -c -x c++ -

glibc-2.39-22.fc40.x86_64
clang-18.1.6-3.fc40.x86_64
gcc-14.2.1-1.fc40.x86_64

_Bool is a C type, not C++ type. There is a bug/workaround in GCC it defines _Bool even in -std=c++. clang more correctly defines _Bool only in -std=gnu++ and not in -std=c++.