#include <sigc++/sigc++.h>

struct T : sigc::trackable
{
   bool Get() const { return value_; }
   void Set(bool value) { value_ = value;  }
   
   bool value_;
};

int main(int argc, char* argv[])
{
   T src;
   sigc::slot<bool> getter = sigc::mem_fun(&src, &T::Get);

   // Deliberately leaking this so leaked slots appear in MemCheck output.
   sigc::signal<void>* signal = new sigc::signal<void>();

   for (int i = 0; i < 10; i++) {
      T dst;
#ifdef WANT_LEAK_SLOT
      sigc::slot<void, bool> setter = sigc::mem_fun(&dst, &T::Set);
      sigc::slot<void> slot = sigc::compose(setter, getter);
#else
      sigc::slot<void> slot =
         sigc::compose(sigc::mem_fun(&dst, &T::Set), getter);
#endif
      signal->connect(slot);
   }

   return 0;
}

