Indeed, default constructor and copy constructor shall not be noexcept qualified.

IMO we should be able to make move constructor noexcept by using a special allocator for the underlying unordered_map that would allow to replace an entry with an other one without requiring a deallocate/allocate. It would be the same kind of allocator keeping a released instance in cache that you already talk about to enhance std::deque behavior especially when used in a std::queue.

For 4.9 we could consider that this test is not supported in profile mode and I will work on it for next version.

François


On 01/26/2014 11:38 AM, Jonathan Wakely wrote:
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


Reply via email to