See here. it seems the error follows c++ standard, although I don't understand well what's written there.
http://gcc.gnu.org/wiki/VerboseDiagnostics#missing_static_const_definition 

Anyway I confirmed your code cannot be compiled if I modify it as below

```
int main(void)
{
    std::cout << a_space::A::i << "\n";
    std::cout << b_space::B::j << "\n";
    return std::max(a_space::A::i, b_space::B::j);
}
```