The name of a class or namespace member
or enumerator can be referred to after the
:: scope resolution operator (
[expr.prim.id.qual]) applied to a
nested-name-specifier that denotes its class,
namespace, or enumeration
. If a
:: scope resolution
operator
in a
nested-name-specifier is not preceded by a
decltype-specifier,
lookup of the name preceding that
:: considers only namespaces, types, and
templates whose specializations are types
. If the
name found does not designate a namespace or a class, enumeration, or dependent type,
the program is ill-formed
. [
Example 1:
class A {
public:
static int n;
};
int main() {
int A;
A::n = 42;
A b;
}
—
end example]