|
From: Matthias S. <zz...@ge...> - 2013-09-29 12:52:23
|
On 29.09.2013 13:16, Damien R wrote:
> Hi,
>
> I am using valgrind 3.7.0 and with the following program, valgrind
> reports no error.
>
> #include <iostream>
>
> struct Foo
> {
> void print()
> {
> std::cout << "foo" << std::endl;
> }
> };
>
> int main()
> {
> Foo * foo = new Foo;
> delete foo;
> foo->print();
> return 0;
> }
>
> Can someone explain why valgrind does not report any error?
>
Hi!
You call Foo::print() on a deleted instance of Foo, but this method does
not access any data from inside Foo and is no virtual method.
So nothing happens, that valgrind should complain about.
Regards
Matthias
|