Boost logo

Boost :

From: Thomas Witt (witt_at_[hidden])
Date: 2002-09-22 10:29:04


Doug,

the current implementation of bound_objects_visitor contains a bug. It fails
to correctly handle bound objects that are based on ptrs to function.

eg.

void foo(int);
bind(&foo, _1);

from trackable.hpp L.89ff

      template<typename T>
      void decode(const T& t, long) const
      {
        typedef truth<(is_pointer<T>::value)> is_a_pointer;
        maybe_get_pointer(t, is_a_pointer());
      }

      // maybe_get_pointer() decides between a pointer and a non-pointer
      template<typename T>
      void maybe_get_pointer(const T& t, truth<true>) const
      {
        add_if_trackable(t);
      }

      ...

      inline void add_if_trackable(const void*) const
      {
      }

What happens is that is_pointer<T> evaluates to true for function ptrs.
maybe_get_pointer in turn calls add_if_trackable with a function pointer
argument. This triggers an no such instance of overloaded function accepts
argument list error as function ptrs are not convertible to void*.

So far I can't come up with an easy and portable fix.

--Thomas

-- 
Dipl.-Ing. Thomas Witt
Institut fuer Verkehrswesen, Eisenbahnbau und -betrieb, Universitaet Hannover
voice: +49(0) 511 762 - 4273, fax: +49(0) 511 762-3001
http://www.ive.uni-hannover.de

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