Boost logo

Boost :

Subject: [boost] [Bug Sprint] [variant] #2839 ambiguous swap call
From: Daniel Hulme (st_at_[hidden])
Date: 2009-06-01 09:58:25


I've just added a test program to ticket #2839: it fails on vc9. The
ticket, I think, explains the problem pretty well, but I would like an
expert to look at the code. I believe that the program is ill-formed,
and it only works on gcc because the BOOST_WORKAROUND disables the code
in question.

The issue is that variant/detail/move.hpp:114 introduces a templated swap()
overload in the same scope it will be called from, to allow move
emulation. But, if the variant bounds a type defined in std::, like
std::vector, then std::swap is another templated swap() and will be
found by ADL. This makes the call ambiguous.

My recommendation is that the move-emulation code be removed -- or
enable_if'd, if that's possible -- until the generalised Boost.Move
implementation is ready to be adopted. If we believe the code as it
stands is correct, then I think the test case should be added to trunk
and release, and additional BOOST_WORKAROUNDs added for all the
compilers where the test fails.

-- 
“Papa Hegel he say that all we learn from history is that we learn noth-
hing from history. I know people who can't even learn from what happened
this morning. Hegel must have been taking the long view.”
   --  John Brunner, ‘Stand on Zanzibar’



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