Qualified name lookup inside class

There is a quote from 3.4.3.1/1:

If a qualified identifier nested qualifier assigns a class, the name specified after the nested qualifier is defined in the scope of the class

But further in paragraph 3.4.3.1/1 it says:

The name must represent one or more members of this class or one of its base classes

And in 3.3.8 / 1 it says:

The potential scope of the name declared in the class consists not only of the declarative region following the dot of the declaration name, but also of all function bodies, default arguments, exception-specifications, and parentheses-equal-initializers non-static data in this class (including such things in nested classes).

This means that base classes are not included in the scope of the derived class. And 3.4.3.1/1 should be redone:

If the qualifier of the qualified identifier nested name assigns a class, the name specified after the nested qualifier is defined in the scope of the class and in the scope of its base classes .

I'm right?

+4
source share
1 answer

No, you're wrong.

What you forget is that he indicated that the name search in the class scope includes looking at the names declared in the direct basics of the specified class, as indicated in 10.2p5.

10.2p5 Username Search [class.member.lookup]

(.. C f ), S(F,C) . C , f B_i suck S(F,B_i), , S(F,C).


, , f C. C f, , C.

( : , f C, C f)

+2

Source: https://habr.com/ru/post/1543652/


All Articles