What part of the standard describes how entity does determine for the declared name? For instance

int foo(){ return 1; }

int main()
{
    int foo(); //I know that this foo denotes the "global" foo.
}

How it's occuring?

有帮助吗?

解决方案

In the C++11 standard, section 3.5p6 states

The name of a function declared in block scope and the name of a variable declared by a block scope extern declaration have linkage. If there is a visible declaration of an entity with linkage having the same name and type, ignoring entities declared outside the innermost enclosing namespace scope, the block scope declaration declares that same entity and receives the linkage of the previous declaration.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top