I'm reading the c++14 N3797 and I've encountered with 3.3.7/1:
If reordering member declarations in a class yields an alternate valid program under (1) and (2), the program is ill-formed, no diagnostic is required.
There are (1) and (2):
1) The potential scope of a name declared in a class consists not only of the declarative region following the name’s point of declaration, but also of all function bodies, default arguments, exception-specifications, and brace-or-equal-initializers of non-static data members in that class (including such things in nested classes).
2) A name N used in a class S shall refer to the same declaration in its context and when re-evaluated in the completed scope of S. No diagnostic is required for a violation of this rule.
That is if we write the following:
class A
{
int a;
int b;
}
then the program is ill-formed. Reorering member declaration yields an alternate valid program:
class A
{
int b;
int a;
}
Might I don't understand this rule correctly?