[Bug c++/107022] error: use of deleted function 'std::unordered_map
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Sep 23 22:22:35 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107022
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to piersh from comment #4)
> struct my_hash
> {
> my_hash() {}
> my_hash(int i = 42) {} // <<-- uncomment for bug
> std::size_t operator()(const key &ep) const { return 0; }
> };
That is because my_hash constructor call with no arguments is ambigous at that
point. If you define one or the other constructor, it is no longer ambigous. If
you define both, the code is invalid.
More information about the Gcc-bugs
mailing list