# GCC and Clang Non-Compliance with C++ Standards

GCC and Clang fail to adhere to C++ language linkage standards.

- **Source:** [Hacker News: Front Page](https://brifing.si/source/b07aa772-b1a0-4a76-aa18-719c6f9e2dde)
- **Published:** 2026-07-19
- **Topic:** [Software & Engineering](https://brifing.si/c/engineering)
- **Original article:** <https://sebsite.pw/w/20260708-badstdcxx.html>
- **On Brifing:** https://brifing.si/s/4f72126f-e990-4848-90a8-2cd512e01378

## What is Language Linkage?

In C++, function types have a 'language linkage' attribute, which determines their calling conventions. This is typically 'C++' or 'C'. The standard mandates that function types with different language linkages should be treated as distinct types, even if they are otherwise identical.

## GCC and Clang's Approach

GCC and Clang compilers do not store language linkage information with function types. As a result, they treat function types with different linkages as identical, contrary to the standard. This highlights their non-compliance with C++ standards.

## Example Code Issue

In an example code snippet, a function type declared with 'extern C' is compared to a regular function type. The compilers incorrectly consider them the same, whereas the standard requires this comparison to fail. This demonstrates a clear deviation from the specification.

## Overloading Problems

When overloading functions that take function pointer parameters, GCC and Clang may produce incorrect compilation errors. The standard requires parameters with different language linkages to be distinct, but the compilers fail to enforce this rule.

## The Role of Standards

The root of the issue lies in the strict rules set by the standards. Compilers like GCC and Clang are reluctant to change their behavior, as it could break ABI compatibility. Some argue that the standard should update this rule to be 'implementation-defined'.

## Conclusion and Impact

This non-compliance could cause issues in projects using multiple language linkages. While the current behavior doesn't cause major problems in practice, updating the standards could provide a long-term solution. The debate highlights the balance between strict compliance and practical implementation.

## Sources covering this story

- https://sebsite.pw/w/20260708-badstdcxx.html — 

---

_Summary written by Brifing from the original reporting. Copyright in the original article belongs to its publisher; read the full piece at the link above._
