From 58878cd405e39092edd1ee293873695a3a0efb1f Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Tue, 11 Feb 2014 10:38:30 +0100 Subject: [PATCH] Work around the clang version installed with MacOS X 10.9. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Apparently their hash tables store the hash functions in a const member, and this requires a user-supplied default constructor. Reported by Étienne Renault. * src/misc/hash.hh: Add an empty constructor to all hash functions. --- src/misc/hash.hh | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/src/misc/hash.hh b/src/misc/hash.hh index 53dc285d0..700c8a583 100644 --- a/src/misc/hash.hh +++ b/src/misc/hash.hh @@ -1,8 +1,9 @@ -// Copyright (C) 2008, 2011 Laboratoire de Recherche et Développement -// de l'Epita (LRDE). +// -*- coding: utf-8 -*- +// Copyright (C) 2008, 2011, 2014 Laboratoire de Recherche et +// Développement de l'Epita (LRDE). // Copyright (C) 2003, 2004, 2005 Laboratoire d'Informatique de -// Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC), -// Université Pierre et Marie Curie. +// Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC), +// Université Pierre et Marie Curie. // // This file is part of Spot, a model checking library. // @@ -80,6 +81,13 @@ namespace spot struct ptr_hash : public std::unary_function { + // A default constructor is needed if the ptr_hash object is + // stored in a const member. This occur with the clang version + // installed by OS X 10.9. + ptr_hash() + { + } + size_t operator()(const T* p) const { return knuth32_hash(reinterpret_cast(p) @@ -97,6 +105,12 @@ namespace spot public Sgi::hash, public std::unary_function { + // A default constructor is needed if the string_hash object is + // stored in a const member. + string_hash() + { + } + size_t operator()(const std::string& s) const { // We are living dangerously. Be sure to call operator() @@ -113,6 +127,12 @@ namespace spot struct identity_hash: public std::unary_function { + // A default constructor is needed if the string_hash object is + // stored in a const member. + identity_hash() + { + } + size_t operator()(const T& s) const { return s;