c++ - n3290 : Elaborated type specifiers syntax changed?

标签 c++ c++11

点自2003年C++03文档:

详尽的类型说明符:第 3.4.4 节,第 1 段:

     "An elaborated-type-specifier  may be used to refer to  a
      previously declared class-name or enum-name even  though
      the name has been hidden by a non-type declaration.  **The
      class-name or enum-name in the elaborated-type-specifier
      may either be a simple identifier or be a qualified-id.**"

但在 n3290 草案中,他们更改了详尽的类型说明符 (7.1.6.3)

7.1.6.3:详尽的类型说明符

 elaborated-type-specifier:
     class-key attribute-specifier-seqopt nested-name-specifieropt identifier
     class-key nested-name-specifieropt templateopt simple-template-id
     enum nested-name-specifieropt identifier

我可以知道吗

1) 早期支持 typename c++03 的 Syntax 有什么问题

     7.1.5.3 Elaborated type specifiers

 elaborated-type-specifier:
      class-key ::opt nested-name-specifieropt identifier
      class-key ::opt nested-name-specifieropt templateopt template-id
      enum ::opt nested-name-specifieropt identifier
      typename ::opt nested-name-specifier identifier
      typename ::opt nested-name-specifier templateopt template-id

2) 是真的编译器遵循/不遵循此规则...(哪个编译器支持此更改)

3) 当来到上面的点3.4.4/1st

      The class-name or enum-name in the elaborated-type-specifier
      may either be a simple identifier or be a qualified-id

为什么在 c++0x 中不允许。

请任何人解释一下? 请任何人解释一下?

(当我尝试添加 c++0x 标签时,它不是..标记..请任何人..添加 c++0x 标签?)

最佳答案

  1. 这是一个简单的重组。 typename-specifier 现在不是一种 elaborated-type-specifier,但它们都是 trailing-type-specifier
  2. 不清楚编译器应该做什么。你能想到不是有效 C++0x 的有效 C++03 代码吗?
  3. 在 C++0x 中到底有什么是不允许的?语法表示此处允许使用限定 ID,如 nested-name-specifier_opt identifier

关于c++ - n3290 : Elaborated type specifiers syntax changed?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7146893/

相关文章:

c++ - 如何记录或重播崩溃前立即执行的行或指令

c++ - C++ 中类成员上的类和 std::async

c++ - 常量和重载构造函数

c++11 - 为什么我不能专门化 std::tuple_element?

c++ - PCL 的主成分分析

c++ - 存储带有日语文本的字符串并写入文件

c++ - 成员未归零,clang++ 错误?

c++ - 在一行中使用两个折叠表达式

c++11 - 我应该在这里使用智能指针吗?

C++:部分特化的手动消歧(使用 SFINAE)