: , .
""?
, , , {}, . T++ PLv4 p157 " ".
[basic.scope.declarative]/1 :
, , , , , .
, , "" .
[basic.scope.declarative]/1 :
, , , , .
. , " " " ", "" , . , [basic.scope.declarative]/3
, , , , [...].
scope , .
"scope"
, , , . . [Stmt.block]/1
.
:
X
: 3.4.3/1
, , -, , , .
class X
{
int m;
void foo() { int n; }
};
decltype(X::m) v;
decltype(X::n) w;
X , - .
X
: 3.3.7/2
:
class X
{
int m;
void foo()
{
decltype(m) n;
}
static int o;
};
int X::o = decltype(m)();
X , .
, , , / . - , 9.3/5
- f X ; X::f , f X X.
, " " -, / , .
" X" . , 3.3.7/2 , " ", " ".
X
: 8.5/13
-.
class X
{
static int m;
static int n;
};
int n;
int o;
int X::m = n;
int X::n = o;
( ) " , " [basic.lookup.unqual]/1. X, , (: ), [basic.lookup.unqual]/7.
" X", , - , , X, , ( ..). , - , , .
X
" X".
3.3.3 - 3.3.9 . , : , , . , , - . :
void foo()
{
int a;
{
int b;
int c;
}
int d;
}
A B ( ). B A. , - "B A, , B, A". :
class A
{
int m;
class B
{
int n;
};
};
" A" B . : .
, - , . , [stmt.block]/1 " ". X , , , (*), , (**), X.
(*) : , .. ( , ) , = ,
(**) : , , , , ,
, , [basic.scope.declarative]/4:
, , [... = ] [... = ].
, , , [basic.scope.declarative]/1:
int main()
{
int x;
{
int x;
}
}
, . X {}; , ++. , .
, { }.