This records a name mangling difference with GCC. It's possible that Clang's decision is desired and we should not take any action.
(I saw a relevant issue about this but I cannot find it now.)
extern "C" {
static void f4(); // the name of the function f4 has internal linkage,
// so f4 has no language linkage; its type has C language linkage
}
If f4 has no language linkage, it seems to make sense to mangle it. So Clang's choice is probably desired.
GCC's decision allows alias/ifunc attributes with an unmangled name like the following:
With Clang, _ZL2f0v is needed. This difference makes such alias/ifunc attributes uses in C++ non-portable. However, this probably does not matter because people rarely use alias/ifunc in C++.
I think certain extensions rely on mangling internal linkage functions in extern "C", e.g. __attribute__((overloadable)).
This records a name mangling difference with GCC. It's possible that Clang's decision is desired and we should not take any action.
(I saw a relevant issue about this but I cannot find it now.)
```cpp
extern "C" {
static void f0() {}
static void f0(int) {}
}
```
* GCC: error: conflicting declaration of C function ‘void f0(int)’
* Clang: accepted; names are mangled
C++ https://eel.is/c++draft/dcl.link gives an example:
```
extern "C" {
static void f4(); // the name of the function f4 has internal linkage,
// so f4 has no language linkage; its type has C language linkage
}
```
If `f4` has no language linkage, it seems to make sense to mangle it. So Clang's choice is probably desired.
GCC's decision allows alias/ifunc attributes with an unmangled name: `void g4() __attribute__((alias("f4")))`.
This records a name mangling difference with GCC. It's possible that Clang's decision is desired and we should not take any action. (I saw a relevant issue about this but I cannot find it now.)
error: conflicting declaration of C function ‘void f0(int)’
C++ https://eel.is/c++draft/dcl.link gives an example:
If
f4
has no language linkage, it seems to make sense to mangle it. So Clang's choice is probably desired.GCC's decision allows alias/ifunc attributes with an unmangled name like the following:
With Clang,
_ZL2f0v
is needed. This difference makes suchalias
/ifunc
attributes uses in C++ non-portable. However, this probably does not matter because people rarely usealias
/ifunc
in C++.I think certain extensions rely on mangling internal linkage functions in
extern "C"
, e.g.__attribute__((overloadable))
.