Reputation: 6390
[basic.lookup.unqual]/8
For the members of a class
X
, a name used in a member function body, in a default argument, in an exceptions-pecification, in the brace-or-equal-initializer of a non-static data member (9.2), or in the definition of a class member outside of the definition ofX
, following the member’s declarator-id 31, shall be declared in one of the following ways:
- before its use in the block in which it is used or in an enclosing block (6.3), or
- shall be a member of class
X
or be a member of a base class ofX
(10.2), or- if
X
is a nested class of classY
(9.7), shall be a member ofY
, or shall be a member of a base class ofY
(this lookup applies in turn toY
’s enclosing classes, starting with the innermost enclosing class),32 or- ...
Footnote:
32) This lookup applies whether the member function is defined within the definition of class
X
or whether the member function is defined in a namespace scope enclosingX
’s definition.
Am I right?
Upvotes: 1
Views: 76
Reputation: 320777
I don't see any reason to tie the footnote to bullet point 3. The only thing the footnote says is that member function defined in in-class fashion can "see" the whole class (as would be the case if it was defined in out-of-class fashion). It applies equally to all bullet points.
For example, footnote 32 reaffirms that this code is valid
struct S
{
void foo() { i = 42; }
int i;
};
I.e. that the definition of S::foo()
can "see" the declaration of S::i
even though S::i
is declared below the definition of S::foo()
. As you can immediately see, the above example has no nested classes and thus has nothing to do with bullet point 3.
Upvotes: 1
Reputation: 385405
The footnote does not mean "this statement is only true for bullet point 3".
It means "by the way, this statement is [also] true for bullet point 3, a slightly more complex scenario with which you may have had your doubts as to the fact so stated".
So, while you're not objectively wrong, this is not any sort of editorial problem either.
Upvotes: 0