The standard [basic.link#2.4] states:
When a name has no linkage, the entity it denotes cannot be referred to by names from other scopes.
According to cppreference:
Member functions of a local class have no linkage.
I haven't been able to find anything in the standard to confirm this, though.
Now consider the following example:
auto make_local() {
struct Local {
void member() {}
};
return Local{};
}
int main() {
auto local = make_local();
local.member(); // Ok
}
This code compiles, even though the name Local::member is referred to in a different scope than it is declared in.
Since this is not what I expected, my understanding of linkage is incorrect. Therefore, my question is - what does it actually mean for an entity to have no linkage?