struct B{}; defines a nested class, then struct B; is a re-declaration of the same nested class.
GCC mistakenly accepts the code ( error report ) because the standard says in [class.mem]:
A member must not be declared twice in the member specification, except that a template of a nested class or a member class can be declared and then defined later,
In your case, the nested class is defined and then declared, which is not valid, which is why Clang and ICC are correct for diagnostics. However, when I check this, they give a warning, not an error, so maybe you are using -Werror , in which case stop doing this, and the code should compile.
The problem in Boost.Bimap code is a known bug .
source share