1) The potential scope of a name declared in a class consists not only of the declarative region following the name’s declarator, but also of all function bodies, default arguments, and constructor ctor- initializers in that class (including such things in nested classes).
НО!
$cat i.cc
class X {
int f(int t, T r=1234) {return 0; }
typedef long T;
};
int main(void){}
$$ g++ i.cc -pedantic -std=c++98
i.cc:2: error: ‘T’ has not been declared
Понятно и очевидно, что надо просто поменять местами typdef и функцию f. И я так и делал. Но если я правильно понял стандарт, то так тоже должно быть. Еще вот определение name
3 An entity is a value, object, subobject, base class subobject, array element, variable, function, instance of a function, enumerator, type, class member, template, or namespace.
4 A name is a use of an identifier (2.10) that denotes an entity or label (6.6.4, 6.1). A variable is introduced by the declaration of an object. The variable’s name denotes the object.