来自[dcl.link]#2 :
extern string-literal declaration
该段落没有指定函数作用域内声明的任何特殊情况,但以下内容也不会编译:
void foo () { extern "C" int boo () ; }
来自 g++ 输出:
error: expected unqualified-id before string constant
这是 g++ 的错误还是我错过了一些东西?
最佳答案
linkage-specification是 declaration 的一部分这是 declaration-seq 的一部分它可以是 namespace-body 的一部分或 translation-unit .
语法中不允许在函数中使用 block-declaration ,这与声明几乎相同,但值得注意的是缺少链接规范。
关于c++ - "extern string-literal declaration"在函数范围内,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43117798/