7.1.5.3 详细类型说明符
7.1.5 .3 详细类型说明符
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
1、只包含详细类型说明符的声明是非法的,除非是显式特化(
class-key identifier ;
friend class-key ::opt identifier ;
friend class-key ::opt template-id ;
friend class-key ::opt nested-name-specifier identifier ;
friend class-key ::opt nested-name-specifier templateopt template-id ;
2、
friend class T;
是非法的] 如果名字查找过程未发现名字的声明,详细类型说明符是非法的,除非它具有class-key identifier的简单形式,在这种情况下,标识符如
3、出现在详细类型说明符中的类关键字和枚举关键字必须和详细类型说明符中的名字被声明的类型一致。这条规则也适用于声明类名或友元类的详细类型说明符形式,因为这种形式可被解释为对类定义的引用。因而,在任何详细类型说明符中,enum关键字必须被用于指向枚举类型(7.2),类关键字union必须被用于指向联合类型(第9章),类关键字class和struct必须被分别用于指向通过类关键字class和struct所声明的类(第9章)。