Fix for fusion pair to make the compiler select the proper copy

constructor and remove a viable, but wrong, constructor. test added.
This commit is contained in:
Joel de Guzman
2014-11-15 09:35:50 +08:00
parent a4660f41af
commit f3fa7a1dc6
2 changed files with 23 additions and 1 deletions

View File

@ -25,6 +25,19 @@
#include <iostream>
#include <string>
struct copy_all
{
copy_all() {}
copy_all(copy_all const&) {}
template <typename T>
copy_all(T const& x)
{
foo(x); // should fail!
}
};
int
main()
{
@ -119,6 +132,13 @@ main()
BOOST_TEST(at_key<char>(make_map<char, int>('X', 123)) == 'X');
BOOST_TEST(at_key<int>(make_map<char, int>('X', 123)) == 123);
}
{
// test for copy construction of fusion pairs
// make sure that the correct constructor is called
pair<int, copy_all> p1;
pair<int, copy_all> p2 = p1;
}
return boost::report_errors();
}