<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW " title="NEW --- - uses-allocator construction for std::pair broken" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D23841&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=hBrAQXsnErbiB6kSQnNaqkGi2VX1Pd0P46WjoI7BH2U&s=813_tMeR6ZErzXnIy3jyliiWKOsayTdLZZ4Ku4izI3I&e=">23841</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>uses-allocator construction for std::pair broken
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libc++
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.6
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>david_work@me.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu, mclow.lists@gmail.com
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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
}</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>