See summary. This is not required for ordinary std::set.
To reproduce:
$ cat bug.cpp
#include "btree_set.h"
#include <set>
class Foo {
int bar_;
public:
explicit Foo(int bar): bar_(bar) {}
};
int main(void) {
btree::btree_set<Foo> a;
std::set<Foo> b;
return 0;
}
$ clang++ bug.cpp -std=c++11 -stdlib=libc++
In file included from bug.cpp:1:
In file included from ./btree_set.h:27:
./btree.h:1402:55: error: no matching constructor for initialization of
'key_type' (aka 'Foo')
sizeof(key_compare_checker(key_compare_helper()(key_type(), key_type()))) ==
^
./btree.h:161:31: note: expanded from macro 'COMPILE_ASSERT'
typedef CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1]
^
./btree_container.h:32:20: note: in instantiation of template class
'btree::btree<btree::btree_set_params<Foo, std::__1::less<Foo>,
std::__1::allocator<Foo>, 256>>' requested here
typedef typename Tree::params_type params_type;
^
./btree_container.h:147:39: note: in instantiation of template class
'btree::btree_container<btree::btree<btree::btree_set_params<Foo,
std::__1::less<Foo>, std::__1::allocator<Foo>, 256>>>' requested here
class btree_unique_container : public btree_container<Tree> {
^
./btree_set.h:37:26: note: in instantiation of template class
'btree::btree_unique_container<btree::btree<btree::btree_set_params<Foo,
std::__1::less<Foo>, std::__1::allocator<Foo>, 256>>>' requested here
class btree_set : public btree_unique_container<
^
bug.cpp:11:25: note: in instantiation of template class 'btree::btree_set<Foo,
std::__1::less<Foo>, std::__1::allocator<Foo>, 256>' requested here
btree::btree_set<Foo> a;
^
bug.cpp:7:12: note: candidate constructor not viable: requires 1 argument, but
0 were provided
explicit Foo(int bar): bar_(bar) {}
^
bug.cpp:4:7: note: candidate constructor (the implicit copy constructor) not
viable: requires 1 argument, but 0 were provided
class Foo {
^
bug.cpp:4:7: note: candidate constructor (the implicit move constructor) not
viable: requires 1 argument, but 0 were provided
1 error generated.
$ clang -v
Apple clang version 4.0 (tags/Apple/clang-421.0.60) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.2
Thread model: posix
Original issue reported on code.google.com by an...@korobeynikov.info on 14 Feb 2013 at 5:46
Original issue reported on code.google.com by
an...@korobeynikov.info
on 14 Feb 2013 at 5:46