冲突声明的 C++ 标准定义

C++ standard definition of conflicting declarations

标准在哪里定义了冲突声明?

例如,如果我在命名空间范围内有以下声明:

extern const int a;
extern int a;

这将是冲突声明的一个例子

根据 [dcl.type]cv-qualifier const 是类型的一部分,因此 const int x;int x;构成变量x.

的不同声明

然后我们到达 [over]/1,其中指出:

When two or more different declarations are specified for a single name in the same scope, that name is said to be overloaded. By extension, two declarations in the same scope that declare the same name but with different types are called overloaded declarations. Only function and function template declarations can be overloaded; variable and type declarations cannot be overloaded.