Support __typeof_unqual__ in C++ front end
Proposes adding __typeof_unqual__ as a GNU extension to g++ to improve compatibility with shared C/C++ headers.
GCC 14 added C23’s typeof_unqual and typeof_unqual to the C front end, but g++ currently rejects typeof_unqual. This extension is used in shared headers to strip qualifiers, causing compilation failures in g++ while working in Clang. This proposal aims to add typeof_unqual support to g++ as a GNU extension, preserving the C23-only status of typeof_unqual.
- proposer
Proposes adding __typeof_unqual__ as a GNU extension to the C++ front end to resolve compatibility issues with shared C/C++ headers that use this construct.
“Because shared C/C++ headers (such as kernel, system, and low-level utility macros) increasingly use __typeof_unqual__ to strip top-level cvr-qualifiers when declaring temporary variables, C++ code including those headers compiles cleanly under Clang but fails under g++. Would there be interest in supporting __typeof_unqual__ as a GNU extension in the C++ front end as well, keeping unprefixed ty…”
In Details
This proposal addresses a compatibility gap between GCC's C and C++ front ends regarding the __typeof_unqual__ extension. While the C front end supports it (following C23), the C++ front end (g++) does not, leading to build failures when C++ code includes headers using this construct, which Clang supports in both C and C++ modes. The goal is to add it as a GNU extension to g++.