Compiler rejects this code so the implicit conversion from const(R) to R breaks mutable field 'stripped' const-correctness.
struct R
{
union
{
const(Object) original;
Object stripped;
}
}
void main()
{
const R cr;
R mr = cr; // Error: cannot implicitly convert expression
// (cr) of type const(R) to R
}
However, I think this is a little restricted behavior. Because qualified and overlapped field is D-specific feature. It's mostly used for bypassing the restriction of const qualifier. Therefore, in many case it would be protected by private access specifier.
The feature is necessary in order to allow const(Rebindable) to Rebindable conversion.