[PATCH] Implement LWG 2686, hash<error_condition>
Jonathan Wakely
jwakely@redhat.com
Tue May 7 15:27:00 GMT 2019
On 04/05/19 15:36 +0100, Jonathan Wakely wrote:
>On 03/05/19 23:42 +0100, Jonathan Wakely wrote:
>>On 23/03/17 17:49 +0000, Jonathan Wakely wrote:
>>>On 12/03/17 13:16 +0100, Daniel Krügler wrote:
>>>>The following is an *untested* patch suggestion, please verify.
>>>>
>>>>Notes: My interpretation is that hash<error_condition> should be
>>>>defined outside of the _GLIBCXX_COMPATIBILITY_CXX0X block, please
>>>>double-check that course of action.
>>>
>>>That's right.
>>>
>>>>I noticed that the preexisting hash<error_code> did directly refer to
>>>>the private members of error_code albeit those have public access
>>>>functions. For consistency I mimicked that existing style when
>>>>implementing hash<error_condition>.
>>>
>>>I see no reason for that, so I've removed the friend declaration and
>>>used the public member functions.
>>
>>I'm going to do the same for hash<error_code> too. It can also use the
>>public members instead of being a friend.
>>
>>
>>>Although this is a DR, I'm treating it as a new C++17 feature, so I've
>>>adjusted the patch to only add the new specialization for C++17 mode.
>>>We're too close to the GCC 7 release to be adding new things to the
>>>default mode, even minor things like this. After GCC 7 is released we
>>>can revisit it and decide if we want to enable it for all modes.
>>
>>We never revisited that, and it's still only enabled for C++17 and up.
>>I guess that's OK, but we could enabled it for C++11 and 14 on trunk
>>if we want. Anybody care enough to argue for that?
>>
>>>Here's what I've tested and will be committing.
>>>
>>>
>>
>>>commit 90ca0fd91f5c65af370beb20af06bdca257aaf63
>>>Author: Jonathan Wakely <jwakely@redhat.com>
>>>Date: Thu Mar 23 11:47:39 2017 +0000
>>>
>>> Implement LWG 2686, std::hash<error_condition>, for C++17
>>> 2017-03-23 Daniel Kruegler <daniel.kruegler@gmail.com>
>>> Implement LWG 2686, Why is std::hash specialized for error_code,
>>> but not error_condition?
>>> * include/std/system_error (hash<error_condition>): Define for C++17.
>>> * testsuite/20_util/hash/operators/size_t.cc (hash<error_condition>):
>>> Instantiate test for error_condition.
>>> * testsuite/20_util/hash/requirements/explicit_instantiation.cc
>>> (hash<error_condition>): Instantiate hash<error_condition>.
I'm adding a similar test for hash<error_code> too.
Tested powerpc64le-linux, committing to trunk shortly.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 2143 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20190507/2122a8ce/attachment.bin>
More information about the Libstdc++
mailing list