https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86852

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |SUSPENDED
   Last reconfirmed|                            |2018-08-04
            Summary|map and unordered_map wrong |[DR 3025] map and
                   |deduction guides for        |unordered_map wrong
                   |inilializer_list            |deduction guides for
                   |                            |inilializer_list
     Ever confirmed|0                           |1

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Michael Veksler from comment #3)
> As you mention, there is https://cplusplus.github.io/LWG/issue3025 ,
> but even if this proposal is accepted things are still too brittle in
> libstd++:
> 
> std::unordered_map m{{1,2}, {3,4}} does not work, and forcing
> std::unordered_map m{std::pair{1,2}, {3,4}} is counterintuitive.

Neither of these works in clang despite following the standard, which is why
there's an open issue (reported by a libstdc++ developer). The current guides
in the standard aren't very useful.


> Worse: 
> std::unordered_map<int,int> m(
>       std::initializer_list<std::pair<int, int>>{
>           {1, 2}, {2, 3}});
> does not work, which means that:
> std::unordered_map m(
>       std::initializer_list<std::pair<int, int>>{
>           {1, 2}, {2, 3}});
> does not work either.

Good! Neither of those should ever be written, and should never pass a code
review. Just say std::unordered_map<int, int>.

I'm suspending this until issue 3025 is resolved, because failing to follow a
defective standard is not a bug.

Reply via email to