libstdc++/41975
Daniel Krügler
daniel.kruegler@googlemail.com
Tue Nov 22 21:11:00 GMT 2011
2011/11/22 Daniel Krügler <daniel.kruegler@googlemail.com>:
> 2011/11/22 François Dumont <frs.dumont@gmail.com>:
>> Hi
>>
>> Here is my latest proposition to fix 41975 defect.
>>
>> Now all tests are passing under linux x86_64. There is no ICE anymore, I
>> don't know where they were coming and I haven't been able to reproduce, a
>> bad build perhaps.
>>
>> There is now the static_assert to check that hash code is cache or that the
>> hash functor is noexcept qualified. The hash codes are cached only where the
>> type is not an integral type and when the hash functor do not throw.
>>
[..]
>> Ok to commit in trunk ?
>
> Regarding:
>
> + static_assert(__or_<integral_constant<bool, __cache_hash_code>,
> + integral_constant<bool,
> + noexcept(declval<const _H1&>()(declval<const _Key&>()))>
> + >::value,
> + "Cache the hash code or qualify your hash functor with noexcept");
>
> I would recommend to wrap the expression test in a wrapper trait combined
> to ensure lazy evaluation. As written, this test is always performed, regardless
> of the value of __cache_hash_code.
Same issue in include/bits/unordered_map.h (twice):
+ bool __cache_hash_code =
+ __not_<__and_<is_integral<_Key>,
+ integral_constant<bool,
+ noexcept(declval<const _Hash&>()(declval<const _Key&>()))>>
+ >::value>
and in unordered_set.h (twice):
+ bool __cache_hash_code =
+ __not_<__and_<is_integral<_Value>,
+ integral_constant<bool,
+ noexcept(declval<const _Hash&>()(declval<const _Value&>()))>>
+ >::value>
- Daniel
More information about the Libstdc++
mailing list