xsk*_*xzr 6 c++ arrays declaration language-lawyer
我对[dcl.array]/1感到困惑:
在TD的声明中,D表格
D1 [ constant-expression opt ] attribute-specifier-seq opt
并且声明T D1中的标识符的类型是" derived-declarator-type-list T",则D的标识符的类型是数组类型; ...
考虑声明:
int (*p)[42];
Run Code Online (Sandbox Code Playgroud)
该声明满足上述语法(并且不满足前面段落中描述的语法),因此本段应该适用,因此我们得出结论,类型p是数组类型.但是,我们知道该类型的p就是pointer to array of 42 int,这是一个指针类型.
我错过了什么吗?或者pointer to array of 42 int确实是阵列类型?
这是标准措辞的一个错误。当然,int (*p)[42];不是数组类型,但是满足[dcl.array]/1中的语法(并且不满足之前[dcl.meaning]/5、[dcl.meaning]/6、[dcl.ptr ]中的语法]/1、[dcl.ref]/1或[dcl.mptr]/1),因此 [dcl.array]/1 应适用。
我已经发布了社论问题。