Boost logo

Boost :

From: Bjorn.Karlsson_at_[hidden]
Date: 2004-02-04 02:37:33


> From: Douglas Paul Gregor [mailto:gregod_at_[hidden]]
>
> Thanks to everyone who has tried this. So it looks like it might be an
> optimizer bug (did anyone else try with optimization on?).
> This probably
> isn't a showstopper bug if it is an optimizer problem
> (especially if one
> needs particularly high optimization settings to trigger it).
> I'll try to
> work around this problem tonight, but it won't make 1.31.0.
>

I've managed (pun intended) to reproduce the problem when compiling with
/CLR (compiles to managed code). The cause is this overloaded function:

namespace detail { namespace function {
  inline bool has_empty_target(...) {
    return false;
  } } }

When this function is called in assign_to (upon construction of the
boost::function), the returned result is true (!), which means that the
perfectly valid function (object) is never assigned, and the boost::function
is thus empty. Oops...

One way around this compiler bug is to avoid the ellipsis function, changing
the signature of has_empty_target to:

namespace detail { namespace function {
  inline bool has_empty_target(const void* f) {
    return false;
  } } }

Cheers,
Bjorn Karlsson
 


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