【问题标题】:"extern string-literal declaration" within function scope函数范围内的“外部字符串文字声明”
【发布时间】:2017-03-30 12:24:51
【问题描述】:

来自[dcl.link]#2

外部字符串文字声明

该段落没有为函数范围内的声明指定任何特殊情况,但以下内容也无法编译:

void foo () { extern "C" int boo () ; }

来自 g++ 输出:

错误:字符串常量之前的预期不合格 id

这是 g++ 的错误还是我遗漏了什么。?

【问题讨论】:

    标签: c++ language-lawyer extern linkage


    【解决方案1】:

    linkage-specificationdeclaration 的一部分,declaration-seq 可以是namespace-bodytranslation-unit 的一部分。

    语法中不允许在函数中使用它,它使用block-declaration,这与声明几乎相同,但值得注意的是缺少链接规范

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-08-27
      • 1970-01-01
      • 2011-06-12
      • 2015-04-12
      • 2019-10-30
      • 2014-04-11
      • 1970-01-01
      相关资源
      最近更新 更多