g++ doesn't find the right ctor
Matthias Kretz
Matthias.Kretz@kip.uni-heidelberg.de
Fri Sep 11 21:40:00 GMT 2009
Hi!
On Friday 11 September 2009 23:31:07 Kalle Olavi Niemitalo wrote:
> int main()
> {
> B b;
> float* B::*p = &B::f;
> const float* B::*q = p; /* luckily not allowed */
> b.*q = &c; /* modifies b.f */
> *b.f = 1; /* tries to modify c, raises SIGSEGV */
> }
>
> which perhaps is less likely than inadvertently dereferencing a
> pointer that points to freed memory, but still.
Thank you very much for that example. Now I understand it! :)
Regards,
Matthias
More information about the Gcc-help
mailing list