Boost logo

Boost :

From: Douglas Gregor (doug.gregor_at_[hidden])
Date: 2005-10-13 07:53:08


On Oct 13, 2005, at 3:44 AM, Markus Schöpflin wrote:

> Seems like this question was missed...
>
> Doug, as you wrote the note I'm referring to below, do you have
> anything
> that could shed some light on it?

Oops, sorry! Brad King tracked down a problem with similar symptoms
to what is happening with Signals, and got it down to this test case:

#include <stdio.h>

struct A
{
   A() { printf("A(): %p\n", this); }
   A(const A&) { printf("A(const A&): %p\n", this); }
   ~A() { printf("~A(): %p\n", this); }
};

struct B: public A
{
   B() { printf("B(): %p\n", this); }
   B(const B& b): A(b) { printf("B(const B&): %p\n", this); }
   ~B() { printf("~B(): %p\n", this); }
};

struct C
{
   operator B () { printf("operator B()\n"); return B(); }
};

void f(A) { printf("f()\n"); }

int main()
{
   C c;
   f(c);
   return 0;
}

IIRC, B::~B() doesn't get called properly for the temporary returned
from operator C::B(), but you'll want to check that before you report
anything.

     Doug


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk