From 32f177328801b16aa7cc57e3cfb2a97f2c104ef9 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sat, 15 Aug 2015 17:03:13 +0200 Subject: [PATCH] fix questionable construct this was spotted by a new GCC warning -Wunused-function and I must admit, GCC is right here: an externally not visible function in an anonymous namespace is not what I'd expect to be picked up by ADL. It is rather weird that the metaprogramming trait worked at all. Note that the function is intentionally declared only, never defined. We want a linker error in case boost::hash ever attempts to use this 'deliberately ill-definded' catch-all. --- src/lib/hash-standard.hpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/lib/hash-standard.hpp b/src/lib/hash-standard.hpp index db3d13073..af022da7d 100644 --- a/src/lib/hash-standard.hpp +++ b/src/lib/hash-standard.hpp @@ -38,7 +38,7 @@ ** to use this boost-style custom hash function if applicable. To allow for such an automatic bridge, ** we have to work around aforementioned problem with the static assertion. Recent discussion threads ** indicate that the GCC and Clang developers are aware of those likely unintended side effects of a - ** well mentioned hint for people to implement their own hash functions. AFAIK, the standard lib shipping + ** well meant hint for people to implement their own hash functions. AFAIK, the standard lib shipping ** with some GCC 4.8.x doesn't contain the assertion anymore; and there are plans to adopt the boost style ** extension mechanism and provide such a bridge in the standard library at some point in the future. ** @@ -78,13 +78,11 @@ namespace lib { namespace meta { - namespace { - struct NoUsableHashDefinition { size_t more_than_one[2]; }; - typedef size_t HasUsableHashDefinition; - - NoUsableHashDefinition hash_value(...); - - } + struct NoUsableHashDefinition { size_t more_than_one[2]; }; + typedef size_t HasUsableHashDefinition; + + NoUsableHashDefinition hash_value(...); ///< declared for metaprogramming only, never defined + /** * trait template to detect if some custom type TY