Linkage specifications nest
. When linkage specifications nest, the
innermost one determines the language linkage
. [
Note 4:
A linkage specification does not establish a scope
. —
end note]
In a
linkage-specification,
the specified language linkage applies
to the function types of all function declarators and
to all functions and variables whose names have external linkage
. [
Example 2:
extern "C"
void f1(void(*pf)(int));
extern "C" typedef void FUNC();
FUNC f2;
extern "C" FUNC f3;
void (*pf2)(FUNC*);
extern "C" {
static void f4();
}
extern "C" void f5() {
extern void f4();
}
extern void f4();
void f6() {
extern void f4();
}
—
end example]
A C language linkage is ignored
in determining the language linkage of
class members,
friend functions with a trailing
requires-clause, and the
function type of non-static class member functions
. [
Example 3:
extern "C" typedef void FUNC_c();
class C {
void mf1(FUNC_c*);
FUNC_c mf2;
static FUNC_c* q;
};
extern "C" {
class X {
void mf();
void mf2(void(*)());
};
}
—
end example]