Modify

Opened 7 months ago

Closed 2 months ago

#12645 closed Bugs (fixed)

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

Reported by: mike.gresens@… Owned by: apolukhin
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 7 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 6 months ago by apolukhin

  • Owner changed from ebf to apolukhin
  • Status changed from new to assigned

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

comment:3 Changed 5 months ago by apolukhin

  • Milestone changed from To Be Determined to Boost 1.64.0

comment:4 Changed 2 months ago by apolukhin

  • Resolution set to fixed
  • Status changed from assigned to closed

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain apolukhin.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.