Reputation: 1581
from [dcl.link]#2 :
extern string-literal declaration
the paragraph does not specify any special cases for declaration within a function scope, but following does not compile also :
void foo () { extern "C" int boo () ; }
from g++ output :
error: expected unqualified-id before string constant
so is it a g++'s bug or i have missed something.?
Upvotes: 2
Views: 141
Reputation: 409166
The linkage-specification is part of declaration which is part of declaration-seq which can be part of a namespace-body or a translation-unit.
Nowhere in the grammar is it allowed in a function, which uses block-declaration, which is almost the same as declaration but is notable missing linkage-specification.
Upvotes: 5