点自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 标签?)
最佳答案
- 这是一个简单的重组。
typename-specifier
现在不是一种elaborated-type-specifier
,但它们都是trailing-type-specifier
。 - 不清楚编译器应该做什么。你能想到不是有效 C++0x 的有效 C++03 代码吗?
- 在 C++0x 中到底有什么是不允许的?语法表示此处允许使用限定 ID,如
nested-name-specifier_opt identifier
。
关于c++ - n3290 : Elaborated type specifiers syntax changed?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7146893/