This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: g++ doesn't find the right ctor


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]