Modify

Opened 12 months ago

Closed 7 months ago

#12645 closed Bugs (fixed)

error: no match for call to ‘(const hash) (const boost::recursive_variant_&)’

Reported by: mike.gresens@… Owned by: Antony Polukhin
Milestone: Boost 1.64.0 Component: variant
Version: Boost 1.63.0 Severity: Regression
Keywords: Cc:

Description

Since boost 1.62 the recursive variant is not able to find the hash function.
Same for boost 1.63 beta.
Compiler stops with error: no match for call to ‘(const hash) (const boost::recursive_variant_&)’

code:

#include <boost/variant.hpp>
#include <unordered_set>

struct hash;

using int_t = int;

template <typename T>
using basic_set_t = std::unordered_set<T, hash>;

using value_t = boost::make_recursive_variant<
		int_t,
		basic_set_t<boost::recursive_variant_>
>::type;

using set_t = basic_set_t<value_t>;

struct hash
{
	// since boost 1.62 ... error: no match for call to ‘(const hash) (const boost::recursive_variant_&)’
	size_t operator()(const value_t& value) const
	{
		return 0;
	}
};

int main()
{
	set_t s;
	int_t i = 3;
	value_t v = i;
	s.emplace(v); // raises error above
	v = s;
	return 0;
}

gcc 6.2.0 on Linux
clang 7.0.2 on Mac

Attachments (0)

Change History (4)

comment:1 in reply to:  description Changed 12 months ago by mike.gresens@…

Workaround for boost >= 1.62. Not sure what changed since 1.61...

code:

#include <boost/variant.hpp>
#include <unordered_set>

struct hash;

using int_t = int;

template <typename T>
using basic_set_t = std::unordered_set<T, hash>;

using value_t = boost::make_recursive_variant<
		int_t,
		basic_set_t<boost::recursive_variant_>
>::type;

using set_t = basic_set_t<value_t>;

struct hash
{
boost::recursive_variant_&)’
	size_t operator()(const value_t& value) const
	{
		return 0;
	}
};

// This helps for boost >= 1.62
namespace std
{
	template <>
	struct __is_fast_hash<::hash> : std::false_type { };
}

int main()
{
	set_t s;
	int_t i = 3;
	value_t v = i;
	s.emplace(v);
	v = s;
	return 0;
}

comment:2 Changed 11 months ago by Antony Polukhin

Owner: changed from ebf to Antony Polukhin
Status: newassigned

Fixed by Mikhail Maximov in e0b65c01. Fix will appear in Boost 1.64

comment:3 Changed 10 months ago by Antony Polukhin

Milestone: To Be DeterminedBoost 1.64.0

comment:4 Changed 7 months ago by Antony Polukhin

Resolution: fixed
Status: assignedclosed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Antony Polukhin.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.