http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56267



Jonathan Wakely <redi at gcc dot gnu.org> changed:



           What    |Removed                     |Added

----------------------------------------------------------------------------

         AssignedTo|unassigned at gcc dot       |redi at gcc dot gnu.org

                   |gnu.org                     |



--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-02-10 
21:57:10 UTC ---

To be really annoying, a hash function could do this:



#include <unordered_set>



struct hash : std::hash<int>

{

  hash() { throw 1; }

  hash(int) { }

};



int main()

{

  std::unordered_set<int, hash>::local_iterator i;

}



We can't detect this at compile-time, so it will fail at runtime.



The Hash requirements only include CopyConstructible and Destructible, so we

should not rely on CopyAssignable or DefaultConstructible, so the local

iterator type should really use placement new to copy-construct the hash

function in an aligned_storage buffer, and on assignment destroy it and

copy-construct a new object using placement new again.

Reply via email to