Opened 13 years ago

Closed 13 years ago

#3534 closed Bugs (fixed)

[signals2] compile error with MSVC 2010 Beta 2

Reported by: Richard Webb <richard.webb@…> Owned by: Frank Mori Hess
Milestone: Boost 1.42.0 Component: signals2
Version: Boost 1.40.0 Severity: Problem
Keywords: Cc:

Description

When trying to build a project that uses Signals2 in VC2010 beta 2, i got the error:

boost/signals2/detail/tracked_objects_visitor.hpp(61): error C2668: 'boost::addressof' : ambiguous call to overloaded function
          \boost/utility/addressof.hpp(51): could be 'T *boost::addressof<const T>(T &)'
          with
          [
              T=lapi::ui::type_1::fn_label_change
          ]
          C:\Program Files\Microsoft Visual Studio 10.0\VC\include\xmemory(109): or       '_Ty *std::addressof<const T>(_Ty &)' [found using argument-dependent lookup]
          with

Seems that it's finding std::addressof via ADL if the type passed to addressof is from namespace std;.

Changing line 61 of tracked_objects_visitor.hpp to use boost::addressof explicitly allows it to compile.

Change History (5)

comment:1 by Frank Mori Hess, 13 years ago

Status: newassigned

Would you provide a minimal example program that generates the compile error, so I can add a test for it?

comment:2 by Richard Webb <richard.webb@…>, 13 years ago

The following code results in the compile error:

#include <boost/signals2/signal.hpp>
#include <functional>

typedef boost::signals2::signal<void (bool)> signal_t;
typedef std::function<void (bool) > fn_t;

int _tmain(int argc, _TCHAR* argv[])
{
	fn_t f;
	signal_t s;
	s.connect(f);

	return 0;
}

However, i ran the Boost regression tests with Beta2 yesterday, and a couple of the existing tests have failed with the same error. e.g.

http://tinyurl.com/ygpvfma http://tinyurl.com/pbmxfr

comment:3 by Frank Mori Hess, 13 years ago

(In [57056]) Qualify addressof call, refs #3534.

comment:4 by Richard Webb <richard.webb@…>, 13 years ago

The Trunk regression tests are all passing for VC10 now.

comment:5 by Frank Mori Hess, 13 years ago

Resolution: fixed
Status: assignedclosed

(In [57450]) Merged [57056] from trunk, closes #3534.

Note: See TracTickets for help on using tickets.