[llvm-bugs] [Bug 26217] New: cannot inherit priority_queue's constructors due to enable_if in some cases.
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Jan 20 02:43:41 PST 2016
https://llvm.org/bugs/show_bug.cgi?id=26217
Bug ID: 26217
Summary: cannot inherit priority_queue's constructors due to
enable_if in some cases.
Product: libc++
Version: 3.7
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: koolcoy at gmail.com
CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com
Classification: Unclassified
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.
--
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/20160120/6a617e55/attachment.html>
More information about the llvm-bugs
mailing list