[Bug c++/80858] When trying to copy std::unordered_map illegally, error message doesn't tell what's wrong
sgunderson at bigfoot dot com
gcc-bugzilla@gcc.gnu.org
Mon May 22 18:48:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80858
--- Comment #2 from sgunderson at bigfoot dot com ---
Yes, I mean that the error message isn't clear (and it's basically the same
error message in 4.8, so no regression).
I don't think I understand the difficulties involved. Doesn't the error come as
a direct result of my copying? If I do this with e.g. std::vector, I get a much
clearer error message, which directly points to the line in question:
[…]
/usr/include/c++/6/bits/vector.tcc:195:19: required from ‘std::vector<_Tp,
_Alloc>& std::vector<_Tp,
_Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp =
std::unique_ptr<int>; _Alloc = std::all
ocator<std::unique_ptr<int> >]’
test.cc:7:7: required from here
My main gripe is that with unordered_map, the error traceback stops in the
internal details of _Hashtable:
/usr/include/c++/7/bits/unordered_map.h:101:11: required from here
In the real-world case in question, I eventually had to go into unordered_map.h
(yes, in /usr/include) and replace “= default;” with “= delete;” to figure out
who was calling the copy constructor.
More information about the Gcc-bugs
mailing list