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

            Bug ID: 70101
           Summary: Allocator-extended priority_queue constructors are
                    badly broken
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rs2740 at gmail dot com
  Target Milestone: ---

None of them is implemented correctly, and several won't compile if actually
used.

      template<typename _Alloc, typename _Requires = _Uses<_Alloc>>
        explicit
        priority_queue(const _Alloc& __a)
        : c(__a) { }

should be ": c(__a), comp()" (the standard says that it value-initializes
comp).

      template<typename _Alloc, typename _Requires = _Uses<_Alloc>>
        priority_queue(const _Compare& __x, const _Alloc& __a)
        : c(__x, __a) { }

should be ": c(__a), comp(__x)".

      template<typename _Alloc, typename _Requires = _Uses<_Alloc>>
        priority_queue(const _Compare& __x, const _Sequence& __c,
                       const _Alloc& __a)
        : c(__x, __c, __a) { }

should be ": c(__c, __a), comp(__x)", and per LWG 2537 should also call
std::make_heap.

      template<typename _Alloc, typename _Requires = _Uses<_Alloc>>
        priority_queue(const _Compare& __x, _Sequence&& __c, const _Alloc& __a)
        : c(__x, std::move(__c), __a) { }

should be ": c(std::move(__c), __a), comp(__x)", and per LWG 2537 should also
call std::make_heap.

      template<typename _Alloc, typename _Requires = _Uses<_Alloc>>
        priority_queue(const priority_queue& __q, const _Alloc& __a)
        : c(__q.c, __a) { }

should be ": c(__q.c, __a), comp(__q.comp)".

      template<typename _Alloc, typename _Requires = _Uses<_Alloc>>
        priority_queue(priority_queue&& __q, const _Alloc& __a)
        : c(std::move(__q.c), __a) { }

should be ": c(std::move(__q.c), __a), comp(std::move(__q.comp))".

Reply via email to