<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 --- - cannot inherit priority_queue's constructors due to enable_if in some cases."
   href="https://llvm.org/bugs/show_bug.cgi?id=26217">26217</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>cannot inherit priority_queue's constructors due to enable_if in some cases.
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.7
          </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>koolcoy@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following code won't compile against libc++ with clang++-3.7 (it compiles
as expected against libstdc++ with clang++-3.7 or g++-5). If data member Foo::f
is moved to a function local scope or to global scope, the code also compiles

#include <queue>

template<typename T, typename Container = std::vector<T>,
        typename Compare = std::less<T>>
class PriorityQueue : public std::priority_queue<T, Container, Compare> {
    using Parent = std::priority_queue<T, Container, Compare>;
public:
    using std::priority_queue<T, Container, Compare>::priority_queue;

    void clear() {
        this->c.clear();
    }
};

struct Foo {
    struct Node {
        int distance;
    };

    struct Compare {
        bool operator () (Node* a, Node* b) const {
            return a->distance < b->distance;
        }
    };

    PriorityQueue<Node*, std::vector<Node*>, Compare> f;
};

void f() {
    Foo x;
};

error message:

In file included from t.cpp:1:
/opt/local/libexec/llvm-3.7/bin/../include/c++/v1/queue:450:43: error: no type
      named 'type' in 'std::__1::enable_if<false, void>'; 'enable_if' cannot be
      used to disable this declaration
                       typename enable_if<uses_allocator<container_type,
                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
t.cpp:8:52: note: in instantiation of member function
      'std::__1::priority_queue<Foo::Node *, std::__1::vector<Foo::Node *,
      std::__1::allocator<Foo::Node *> >, Foo::Compare>::priority_queue'
      requested here
        using std::priority_queue<T, Container, Compare>::priority_queue;
                                                          ^
t.cpp:5:7: note: while substituting deduced template arguments into function
      template 'PriorityQueue' [with _Alloc = PriorityQueue<Foo::Node *,
      std::__1::vector<Foo::Node *, std::__1::allocator<Foo::Node *> >,
      Foo::Compare>]
class PriorityQueue : public std::priority_queue<T, Container, Compare> {
      ^
In file included from t.cpp:1:
/opt/local/libexec/llvm-3.7/bin/../include/c++/v1/queue:450:43: error: no type
      named 'type' in 'std::__1::enable_if<false, void>'; 'enable_if' cannot be
      used to disable this declaration
                       typename enable_if<uses_allocator<container_type,
                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.</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>