profile mode fix
Jonathan Wakely
jwakely.gcc@gmail.com
Sun Jan 26 10:38:00 GMT 2014
On 26 January 2014 09:43, François Dumont wrote:
> Hi
>
> This is a patch to fix PR 55033 in profile mode. Like in debug mode it
> was missing noexcept qualifier on move constructor.
But don't those functions allocate memory? So they can throw.
I agree we want the move constructor to be noexcept anyway, and maybe
the default constructor, but why would we want to lie about the copy
constructor?
I have this patch in my tree that I'm trying to decide whether it
should be committed, but if we make the change we should have a
comment like this:
--- a/libstdc++-v3/include/profile/unordered_base.h
+++ b/libstdc++-v3/include/profile/unordered_base.h
@@ -160,9 +160,14 @@ namespace __profile
__profcxx_hashtable_construct(&__uc, __uc.bucket_count());
__profcxx_hashtable_construct2(&__uc);
}
+
_Unordered_profile(const _Unordered_profile&)
: _Unordered_profile() { }
- _Unordered_profile(_Unordered_profile&&)
+
+ // This might actually throw, but for consistency with normal mode
+ // unordered containers we want the noexcept specification, and will
+ // std::terminate() if an exception is thrown.
+ _Unordered_profile(_Unordered_profile&&) noexcept
: _Unordered_profile() { }
~_Unordered_profile() noexcept
More information about the Libstdc++
mailing list