== Quote from bearophile (bearophileh...@lycos.com)'s article
> Sean Eskapp:
> > Nevermind, I realized it's because constness is transitive in pointers. A 
> > const
> > struct with a pointer member has a const pointer member, and those can't be
> > implicitly cast to non-const pointer members.
> Uhm, the struct having a pointer is not important. In theory this too can't 
> compile:
> struct Bar {}
> void foo(Bar b) {}
> void main() {
>     const b = Bar();
>     foo(b);
> }
> Is this another compiler bug?
> Bye,
> bearophile

No, that compiles fine. Because the struct owns a pointer, the const struct 
owns a
const pointer. When copying a const-struct to a non-const struct, this means you
must cast a const-pointer to a non-const pointer, which shouldn't be allowed.

Reply via email to