If the makers of g++ (and clang) misread the Standard a bit, they
interpreted that any declaration, even with 'extern' that follows a
declaration with 'static', does not override the linkage of the object,
but declares the same object, which has the same linkage as has been
declared already, i.e. internal here. See [basic.link]/6. However,
that particular part of the Standard talks specifically about functions
and variables declared in *block* scope, as the example that follows shows.
I cannot imagine any other error by the developers of those compilers.
And I agree with your determination that the same object cannot have two
linkages when declared *in the same scope*.
Curiously, I seem to have never seen any comments by compiler
implementors here. Either they are too busy to participate in any
community activities, or there are so few of them that their posts are
simply lost in the torrent of other articles, or they purposely avoid
the forum... It would be interesting to hear/see an interpretation of
theirs, however.
V
--
I do not respond to top-posted replies, please don't ask