Consider the following code:
GCC compiles it , just warning about unused variables.
Visual C ++ 2015, however, does not compile it with:
error C2326: 'void A::StaticFunc(void)': function cannot access 'A::B::M'
on the lines
const std::size_t s0 = sizeof(::A::B::M); const std::size_t s1 = sizeof(A::B::M);
in StaticFunc() .
The other line s2 = ... and s3 = ... in main() compiles in order.
Is this a bug in MSVC, or am I missing something basic here?
c ++ visual-c ++ compiler-bug visual-c ++ - 2015
alain
source share