术语"函数声明"在§7/9(N4140)中定义,但它没有被定义为语法生产。为什么?



在§7/9中,您将找到函数声明的定义

如果decl说明符seq不包含typedef说明符,则如果关联的类型名称为函数类型(8.3.5)和对象声明否则

在§7/1中,您可以找到语法生成声明的定义,但作为该定义的一部分,其中没有指定函数声明

由于该段讨论了init声明符,我将其应用于简单声明中,其中有一个init声明符列表。你可以看到这不是完全正确的

// clearly, this is not the declaration of an object, so it should
// not be called an "object declaration", but 7p9 does say so
int &a = x;
struct A {
   // AFAICS 7p9 should also apply here, but there is no init-declarator
   // here, but a member-declarator. 9.2 also doesn't delegate to 7p9.
   typedef int a;
};

其结果是,下面还包含一个函数声明,但该声明声明的不是函数。

template<typename T> void f();

总之,我认为规范中需要对该文本进行一些澄清。

最新更新