[LLVMbugs] [Bug 23841] New: uses-allocator construction for std::pair broken

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Jun 13 17:03:33 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=23841

            Bug ID: 23841
           Summary: uses-allocator construction for std::pair broken
           Product: libc++
           Version: 3.6
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: david_work at me.com
                CC: llvmbugs at cs.uiuc.edu, mclow.lists at gmail.com
    Classification: Unclassified

Uses-allocator construction is not applied to std::pair value_types.

The following program is valid and accepted by GCC.


#include <scoped_allocator>
#include <memory>
#include <list>
#include <set>
#include <map>

template< typename t >
struct al : std::allocator< t > {
    al() = default;
    template< typename u >
    al( al< u > const & ) {}

    typedef std::false_type propagate_on_container_move_assignment;
    typedef std::false_type is_always_equal;

    template< typename u >
    struct rebind { typedef al< u > other; };
};

struct val;
typedef std::scoped_allocator_adaptor< al< val > > alt;

struct val {
    val( int ) {}
    val( val const & ) = delete;
    val( val const &, alt ) {}
};

struct yeah {
    template< typename t >
    bool operator () ( t const &, t const & ) const { return true; }
};

int main() {
    std::list< val, alt > l;
    l.emplace_back( 41 ); // OK

    std::set< val, yeah, alt > sok;
    sok.emplace( 40 ); // OK

    std::set< std::pair< int, val >, yeah, alt > s;
    s.emplace( 5, 42 ); // rejected

    std::map< int, val, yeah, alt > m;
    m.emplace( 6, 42 ); // rejected
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150614/737256d6/attachment.html>


More information about the llvm-bugs mailing list