erikerlandson / st_tree

A fast and flexible c++ template class for tree data structures
https://github.com/erikerlandson/st_tree/wiki
Apache License 2.0
95 stars 20 forks source link

CLang / Xcode issues #18

Closed JonHodgson closed 8 years ago

JonHodgson commented 8 years ago

I've been compiling and using the library successfully in Visual Studio 2013 (well apart from one small fix), but when I try to compile the test and example projects in Xcode, all hell breaks loose, with 168 errors. This happens whether I use my modified version, or the latest Master or 16 branch form GitHub.

Taking just one file as an example..

At line 147 of st_tree-nodes.h

typedef typename base_type::cs_iterator cs_iterator;

The error given is that cs_iterator is a protected member of the base_type. But base_type is a public parent of the class, so that would seem to be ok. .

CompileC /Volumes/BOOTCAMP/Users/Jon/Documents/Visual\ Studio\ 2013/Projects/WPF/BuildOSX/st_tree_master/examples/st_tree.build/Debug/x06_graft.build/Objects-normal/x86_64/x06_graft.o examples/x06_graft.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler cd /Users/jon/Downloads/st_tree-master export LANG=en_US.US-ASCII /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c++ -arch x86_64 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-shorten-64-to-32 -Wno-newline-eof -Wno-c++11-extensions -DCMAKE_INTDIR=\"Debug\" -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -Winvalid-offsetof -mmacosx-version-min=10.10 -g -Wno-sign-conversion -I/Volumes/BOOTCAMP/Users/Jon/Documents/Visual\ Studio\ 2013/Projects/WPF/BuildOSX/st_tree_master/examples/Debug/include -I/Users/jon/Downloads/st_tree-master/include -I/Volumes/BOOTCAMP/Users/Jon/Documents/Visual\ Studio\ 2013/Projects/WPF/BuildOSX/st_tree_master/examples/st_tree.build/Debug/x06_graft.build/DerivedSources/x86_64 -I/Volumes/BOOTCAMP/Users/Jon/Documents/Visual\ Studio\ 2013/Projects/WPF/BuildOSX/st_tree_master/examples/st_tree.build/Debug/x06_graft.build/DerivedSources -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -F/Volumes/BOOTCAMP/Users/Jon/Documents/Visual\ Studio\ 2013/Projects/WPF/BuildOSX/st_tree_master/examples/Debug -MMD -MT dependencies -MF /Volumes/BOOTCAMP/Users/Jon/Documents/Visual\ Studio\ 2013/Projects/WPF/BuildOSX/st_tree_master/examples/st_tree.build/Debug/x06_graft.build/Objects-normal/x86_64/x06_graft.d --serialize-diagnostics /Volumes/BOOTCAMP/Users/Jon/Documents/Visual\ Studio\ 2013/Projects/WPF/BuildOSX/st_tree_master/examples/st_tree.build/Debug/x06_graft.build/Objects-normal/x86_64/x06_graft.dia -c /Users/jon/Downloads/st_tree-master/examples/x06_graft.cpp -o /Volumes/BOOTCAMP/Users/Jon/Documents/Visual\ Studio\ 2013/Projects/WPF/BuildOSX/st_tree_master/examples/st_tree.build/Debug/x06_graft.build/Objects-normal/x86_64/x06_graft.o

In file included from /Users/jon/Downloads/st_tree-master/examples/x06_graft.cpp:28: In file included from /Users/jon/Downloads/st_tree-master/include/st_tree.h:97: In file included from /Users/jon/Downloads/st_tree-master/include/st_tree_detail.h:24: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:499:5: error: implicit instantiation of undefined template 'static_assert_test' static_assert((is_same<typename allocator_type::value_type, value_type>::value), ^ In file included from /Users/jon/Downloads/st_tree-master/examples/x06_graft.cpp:22: In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:434: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:553:35: note: expanded from macro 'static_assert' typedef static_assert_check<sizeof(static_assert_test<(b)>)> \ ^ In file included from /Users/jon/Downloads/st_tree-master/examples/x06_graft.cpp:28: In file included from /Users/jon/Downloads/st_tree-master/include/st_tree.h:105: /Users/jon/Downloads/st_tree-master/include/st_tree_nodes.h:47:22: note: in instantiation of template class 'std::1::vector<st_tree::detail::node_raw<st_tree::tree<std::1::basic_string, st_tree::raw, std::1::allocatorstd::__1::basic_string >, std::1::basicstring > , std::1::allocatorstd::1::basic_string >' requested here typedef typename cs_type::iterator cs_iterator; ^ /Users/jon/Downloads/st_tree-master/include/st_tree_nodes.h:272:25: note: in instantiation of template class 'st_tree::detail::node_base<st_tree::tree<std::1::basic_string, st_tree::raw, std::1::allocatorstd::1::basic_string >, st_tree::detail::node_raw<st_tree::tree<std::1::basic_string, st_tree::raw, std::1::allocatorstd::1::basic_string >, std::1::basic_string >, std::__1::vector<st_tree::detail::node_raw<st_tree::tree<std::1::basic_string, st_tree::raw, std::1::allocatorstd::1::basic_string >, std::1::basic_string > *, std::1::allocatorstd::1::basic_string > >' requested here struct node_raw: public node_base<Tree, node_raw<Tree, Data>, vector<noderaw<Tree, Data>, typename Tree::allocator_type> > { ^ In file included from /Users/jon/Downloads/st_tree-master/examples/x06_graft.cpp:28: /Users/jon/Downloads/st_tree-master/include/st_tree.h:127:22: note: in instantiation of template class 'st_tree::detail::node_raw<st_tree::tree<std::1::basic_string, st_tree::raw, std::1::allocatorstd::__1::basic_string >, std::1::basic_string >' requested here typedef typename node_type::base_type node_base_type; ^ /Users/jon/Downloads/st_tree-master/examples/x06_graft.cpp:35:18: note: in instantiation of template class 'st_tree::treestd::1::basic_string<char, st_tree::raw, std::1::allocatorstd::1::basic_string >' requested here tree t; ^ In file included from /Users/jon/Downloads/st_tree-master/examples/x06_graft.cpp:22: In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:434: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/config:549:24: note: template is declared here template struct static_assert_test; ^ In file included from /Users/jon/Downloads/st_tree-master/examples/x06_graft.cpp:28: In file included from /Users/jon/Downloads/st_tree-master/include/st_tree.h:97: In file included from /Users/jon/Downloads/st_tree-master/include/st_tree_detail.h:24: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:499:5: error: implicit instantiation of undefined template 'static_assert_test' static_assert((is_same<typename allocator_type::value_type, value_type>::value), ^ In file included from /Users/jon/Downloads/st_tree-master/examples/x06_graft.cpp:22: In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:434: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/config:553:35: note: expanded from macro 'static_assert' typedef static_assert_check<sizeof(static_assert_test<(__b)>)> \ ^ In file included from /Users/jon/Downloads/st_tree-master/examples/x06_graft.cpp:28: In file included from /Users/jon/Downloads/st_tree-master/include/st_tree.h:97: /Users/jon/Downloads/st_tree-master/include/st_tree_detail.h:112:29: note: in instantiation of template class 'std::1::vector<unsigned long, std::1::allocator<std::1::basic_string > >' requested here vector<Unsigned, Alloc> _hist; ^ In file included from /Users/jon/Downloads/st_tree-master/examples/x06_graft.cpp:28: In file included from /Users/jon/Downloads/st_tree-master/include/st_tree.h:105: /Users/jon/Downloads/st_tree-master/include/st_tree_nodes.h:180:47: note: in instantiation of template class 'st_tree::detail::max_maintainer<unsigned long, std::1::allocator<std::1::basic_string > >' requested here max_maintainer<size_type, allocator_type> _depth; ^ /Users/jon/Downloads/st_tree-master/include/st_tree_nodes.h:272:25: note: in instantiation of template class 'st_tree::detail::node_base<st_tree::tree<std::1::basic_string, st_tree::raw, std::1::allocatorstd::1::basic_string >, st_tree::detail::node_raw<st_tree::tree<std::1::basic_string, st_tree::raw, std::1::allocatorstd::1::basic_string >, std::1::basic_string >, std::__1::vector<st_tree::detail::node_raw<st_tree::tree<std::1::basic_string, st_tree::raw, std::1::allocatorstd::1::basic_string >, std::1::basicstring > , std::1::allocatorstd::1::basic_string > >' requested here struct node_raw: public node_base<Tree, node_raw<Tree, Data>, vector<noderaw<Tree, Data>, typename Tree::allocator_type> > { ^ In file included from /Users/jon/Downloads/st_tree-master/examples/x06_graft.cpp:28: /Users/jon/Downloads/st_tree-master/include/st_tree.h:127:22: note: in instantiation of template class 'st_tree::detail::node_raw<st_tree::tree<std::1::basic_string, st_tree::raw, std::1::allocatorstd::1::basic_string >, std::1::basic_string >' requested here typedef typename node_type::base_type node_base_type; ^ /Users/jon/Downloads/st_tree-master/examples/x06_graft.cpp:35:18: note: in instantiation of template class 'st_tree::treestd::1::basic_string<char, st_tree::raw, std::1::allocatorstd::1::basic_string >' requested here tree t; ^ In file included from /Users/jon/Downloads/st_tree-master/examples/x06_graft.cpp:22: In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:434: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/config:549:24: note: template is declared here template struct static_assert_test; ^ In file included from /Users/jon/Downloads/st_tree-master/examples/x06_graft.cpp:28: In file included from /Users/jon/Downloads/st_tree-master/include/st_tree.h:105: /Users/jon/Downloads/st_tree-master/include/st_tree_nodes.h:447:33: error: 'cs_iterator' is a protected member of 'st_tree::detail::node_base<st_tree::tree<std::1::basic_string, st_tree::raw, std::1::allocatorstd::1::basic_string >, st_tree::detail::node_raw<st_tree::tree<std::1::basic_string, st_tree::raw, std::1::allocatorstd::1::basic_string >, std::1::basic_string >, std::__1::vector<st_tree::detail::node_raw<st_tree::tree<std::1::basic_string, st_tree::raw, std::1::allocatorstd::1::basic_string >, std::1::basicstring > , std::1::allocatorstd::1::basic_string > >' typedef typename base_type::cs_iterator cs_iterator; ^ In file included from /Users/jon/Downloads/st_tree-master/examples/x06_graft.cpp:28: /Users/jon/Downloads/st_tree-master/include/st_tree.h:127:22: note: in instantiation of template class 'st_tree::detail::node_raw<st_tree::tree<std::1::basic_string, st_tree::raw, std::1::allocatorstd::__1::basic_string >, std::1::basic_string >' requested here typedef typename node_type::base_type node_base_type; ^ /Users/jon/Downloads/st_tree-master/examples/x06_graft.cpp:35:18: note: in instantiation of template class 'st_tree::treestd::1::basic_string<char, st_tree::raw, std::1::allocatorstd::1::basic_string >' requested here tree t; ^ In file included from /Users/jon/Downloads/st_tree-master/examples/x06_graft.cpp:28: In file included from /Users/jon/Downloads/st_tree-master/include/st_tree.h:105: /Users/jon/Downloads/st_tree-master/include/st_tree_nodes.h:47:40: note: declared protected here typedef typename cs_type::iterator cs_iterator; ^ /Users/jon/Downloads/st_tree-master/include/st_tree_nodes.h:448:33: error: 'cs_const_iterator' is a protected member of 'st_tree::detail::node_base<st_tree::tree<std::1::basic_string, st_tree::raw, std::1::allocatorstd::1::basic_string >, st_tree::detail::node_raw<st_tree::tree<std::1::basic_string, st_tree::raw, std::1::allocatorstd::1::basic_string >, std::__1::basic_string >, std::1::vector<st_tree::detail::node_raw<st_tree::tree<std::1::basic_string, st_tree::raw, std::1::allocatorstd::1::basic_string >, std::__1::basic_string > *, std::1::allocatorstd::1::basic_string > >' typedef typename base_type::cs_const_iterator cs_const_iterator; ^ /Users/jon/Downloads/st_tree-master/include/st_tree_nodes.h:48:46: note: declared protected here typedef typename cs_type::const_iterator cs_const_iterator; ^ In file included from /Users/jon/Downloads/st_tree-master/examples/x06_graft.cpp:28: /Users/jon/Downloads/st_tree-master/include/st_tree.h:136:33: error: no type named 'bf_iterator' in 'st_tree::detail::node_raw<st_tree::tree<std::1::basic_string, st_tree::raw, std::1::allocatorstd::__1::basic_string >, std::1::basic_string >' typedef typename node_type::bf_iterator iterator;


/Users/jon/Downloads/st_tree-master/examples/x06_graft.cpp:35:18: note: in instantiation of template class 'st_tree::treestd::__1::basic_string<char, st_tree::raw<st_tree::arg_unused>, std::__1::allocatorstd::__1::basic_string<char > >' requested here
    tree<string> t;
                 ^
In file included from /Users/jon/Downloads/st_tree-master/examples/x06_graft.cpp:28:
/Users/jon/Downloads/st_tree-master/include/st_tree.h:137:33: error: no type named 'const_bf_iterator' in 'st_tree::detail::node_raw<st_tree::tree<std::__1::basic_string<char>, st_tree::raw<st_tree::arg_unused>, std::__1::allocatorstd::__1::basic_string<char > >, std::__1::basic_string<char> >'
    typedef typename node_type::const_bf_iterator const_iterator;
            ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/Users/jon/Downloads/st_tree-master/include/st_tree.h:138:33: error: no type named 'bf_iterator' in 'st_tree::detail::node_raw<st_tree::tree<std::__1::basic_string<char>, st_tree::raw<st_tree::arg_unused>, std::__1::allocatorstd::__1::basic_string<char > >, std::__1::basic_string<char> >'
    typedef typename node_type::bf_iterator bf_iterator;
            ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
/Users/jon/Downloads/st_tree-master/include/st_tree.h:139:33: error: no type named 'const_bf_iterator' in 'st_tree::detail::node_raw<st_tree::tree<std::__1::basic_string<char>, st_tree::raw<st_tree::arg_unused>, std::__1::allocatorstd::__1::basic_string<char > >, std::__1::basic_string<char> >'
    typedef typename node_type::const_bf_iterator const_bf_iterator;
            ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/Users/jon/Downloads/st_tree-master/include/st_tree.h:140:33: error: no type named 'df_post_iterator' in 'st_tree::detail::node_raw<st_tree::tree<std::__1::basic_string<char>, st_tree::raw<st_tree::arg_unused>, std::__1::allocatorstd::__1::basic_string<char > >, std::__1::basic_string<char> >'
    typedef typename node_type::df_post_iterator df_post_iterator;
            ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
/Users/jon/Downloads/st_tree-master/include/st_tree.h:141:33: error: no type named 'const_df_post_iterator' in 'st_tree::detail::node_raw<st_tree::tree<std::__1::basic_string<char>, st_tree::raw<st_tree::arg_unused>, std::__1::allocatorstd::__1::basic_string<char > >, std::__1::basic_string<char> >'
    typedef typename node_type::const_df_post_iterator const_df_post_iterator;
            ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/Users/jon/Downloads/st_tree-master/include/st_tree.h:142:33: error: no type named 'df_pre_iterator' in 'st_tree::detail::node_raw<st_tree::tree<std::__1::basic_string<char>, st_tree::raw<st_tree::arg_unused>, std::__1::allocatorstd::__1::basic_string<char > >, std::__1::basic_string<char> >'
    typedef typename node_type::df_pre_iterator df_pre_iterator;
            ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
/Users/jon/Downloads/st_tree-master/include/st_tree.h:143:33: error: no type named 'const_df_pre_iterator' in 'st_tree::detail::node_raw<st_tree::tree<std::__1::basic_string<char>, st_tree::raw<st_tree::arg_unused>, std::__1::allocatorstd::__1::basic_string<char > >, std::__1::basic_string<char> >'
    typedef typename node_type::const_df_pre_iterator const_df_pre_iterator;
            ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
/Users/jon/Downloads/st_tree-master/include/st_tree.h:190:16: error: no member named '_data' in 'st_tree::detail::node_raw<st_tree::tree<std::__1::basic_string<char>, st_tree::raw<st_tree::arg_unused>, std::__1::allocatorstd::__1::basic_string<char > >, std::__1::basic_string<char> >'
        _root->_data = data;
        ~~~~~  ^
/Users/jon/Downloads/st_tree-master/examples/x06_graft.cpp:43:8: note: in instantiation of member function 'st_tree::treestd::__1::basic_string<char, st_tree::raw<st_tree::arg_unused>, std::__1::allocatorstd::__1::basic_string<char > >::insert' requested here
    t2.insert("T");
       ^
In file included from /Users/jon/Downloads/st_tree-master/examples/x06_graft.cpp:28:
/Users/jon/Downloads/st_tree-master/include/st_tree.h:191:16: error: no member named '_tree' in 'st_tree::detail::node_raw<st_tree::tree<std::__1::basic_string<char>, st_tree::raw<st_tree::arg_unused>, std::__1::allocatorstd::__1::basic_string<char > >, std::__1::basic_string<char> >'
        _root->_tree = this;
        ~~~~~  ^
/Users/jon/Downloads/st_tree-master/include/st_tree.h:192:16: error: no member named '_depth' in 'st_tree::detail::node_raw<st_tree::tree<std::__1::basic_string<char>, st_tree::raw<st_tree::arg_unused>, std::__1::allocatorstd::__1::basic_string<char > >, std::__1::basic_string<char> >'
        _root->_depth.insert(1);
        ~~~~~  ^
In file included from /Users/jon/Downloads/st_tree-master/examples/x06_graft.cpp:28:
In file included from /Users/jon/Downloads/st_tree-master/include/st_tree.h:105:
/Users/jon/Downloads/st_tree-master/include/st_tree_nodes.h:295:18: error: type 'base_type' (aka 'node_base<st_tree::tree<std::__1::basic_string<char>, st_tree::raw<st_tree::arg_unused>, std::__1::allocatorstd::__1::basic_string<char > >, node_type, cs_type>') is not a direct or virtual base of 'st_tree::detail::node_raw<st_tree::tree<std::__1::basic_string<char>, st_tree::raw<st_tree::arg_unused>, std::__1::allocatorstd::__1::basic_string<char > >, std::__1::basic_string<char> >'
    node_raw() : base_type() {}
                 ^~~~~~~~~
In file included from /Users/jon/Downloads/st_tree-master/examples/x06_graft.cpp:28:
/Users/jon/Downloads/st_tree-master/include/st_tree.h:305:82: note: in instantiation of member function 'st_tree::detail::node_raw<st_tree::tree<std::__1::basic_string<char>, st_tree::raw<st_tree::arg_unused>, std::__1::allocatorstd::__1::basic_string<char > >, std::__1::basic_string<char> >::node_raw' requested here
const typename tree<Data, CSModel, Alloc>::node_type tree<Data, CSModel, Alloc>::_node_init_val;
                                                                                 ^
/Users/jon/Downloads/st_tree-master/include/st_tree.h:285:38: note: in instantiation of static data member 'st_tree::treestd::__1::basic_string<char, st_tree::raw<st_tree::arg_unused>, std::__1::allocatorstd::__1::basic_string<char > >::_node_init_val' requested here
        _node_allocator.construct(n, _node_init_val);
                                     ^
/Users/jon/Downloads/st_tree-master/include/st_tree.h:189:17: note: in instantiation of member function 'st_tree::treestd::__1::basic_string<char, st_tree::raw<st_tree::arg_unused>, std::__1::allocatorstd::__1::basic_string<char > >::_new_node' requested here
        _root = _new_node();
                ^
/Users/jon/Downloads/st_tree-master/examples/x06_graft.cpp:43:8: note: in instantiation of member function 'st_tree::treestd::__1::basic_string<char, st_tree::raw<st_tree::arg_unused>, std::__1::allocatorstd::__1::basic_string<char > >::insert' requested here
    t2.insert("T");
       ^
In file included from /Users/jon/Downloads/st_tree-master/examples/x06_graft.cpp:28:
In file included from /Users/jon/Downloads/st_tree-master/include/st_tree.h:105:
/Users/jon/Downloads/st_tree-master/include/st_tree_nodes.h:298:37: error: type 'base_type' (aka 'node_base<st_tree::tree<std::__1::basic_string<char>, st_tree::raw<st_tree::arg_unused>, std::__1::allocatorstd::__1::basic_string<char > >, node_type, cs_type>') is not a direct or virtual base of 'st_tree::detail::node_raw<st_tree::tree<std::__1::basic_string<char>, st_tree::raw<st_tree::arg_unused>, std::__1::allocatorstd::__1::basic_string<char > >, std::__1::basic_string<char> >'
    node_raw(const node_raw& src) : base_type() {
                                    ^~~~~~~~~
In file included from /Users/jon/Downloads/st_tree-master/examples/x06_graft.cpp:22:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:439:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/algorithm:628:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:1696:31: note: in instantiation of member function 'st_tree::detail::node_raw<st_tree::tree<std::__1::basic_string<char>, st_tree::raw<st_tree::arg_unused>, std::__1::allocatorstd::__1::basic_string<char > >, std::__1::basic_string<char> >::node_raw' requested here
            ::new((void_)__p) _Tp(__a0);
                              ^
In file included from /Users/jon/Downloads/st_tree-master/examples/x06_graft.cpp:28:
/Users/jon/Downloads/st_tree-master/include/st_tree.h:285:25: note: in instantiation of function template specialization 'std::__1::allocator<st_tree::detail::node_raw<st_tree::tree<std::__1::basic_string<char>, st_tree::raw<st_tree::arg_unused>, std::__1::allocatorstd::__1::basic_string<char > >, std::__1::basic_string<char> > >::construct<st_tree::detail::node_raw<st_tree::tree<std::__1::basic_string<char>, st_tree::raw<st_tree::arg_unused>, std::__1::allocatorstd::__1::basic_string<char > >, std::__1::basic_string<char> > >' requested here
        _node_allocator.construct(n, _node_init_val);
                        ^
/Users/jon/Downloads/st_tree-master/include/st_tree.h:189:17: note: in instantiation of member function 'st_tree::treestd::__1::basic_string<char, st_tree::raw<st_tree::arg_unused>, std::__1::allocatorstd::__1::basic_string<char > >::_new_node' requested here
        _root = _new_node();
                ^
/Users/jon/Downloads/st_tree-master/examples/x06_graft.cpp:43:8: note: in instantiation of member function 'st_tree::treestd::__1::basic_string<char, st_tree::raw<st_tree::arg_unused>, std::__1::allocatorstd::__1::basic_string<char > >::insert' requested here
    t2.insert("T");
       ^
In file included from /Users/jon/Downloads/st_tree-master/examples/x06_graft.cpp:28:
In file included from /Users/jon/Downloads/st_tree-master/include/st_tree.h:105:
/Users/jon/Downloads/st_tree-master/include/st_tree_nodes.h:300:17: error: no member named '_default_constructed' in 'st_tree::detail::node_raw<st_tree::tree<std::__1::basic_string<char>, st_tree::raw<st_tree::arg_unused>, std::__1::allocatorstd::__1::basic_string<char > >, std::__1::basic_string<char> >'
        if (src._default_constructed()) return;
            ~~~ ^
/Users/jon/Downloads/st_tree-master/include/st_tree_nodes.h:308:17: error: no member named '_default_constructed' in 'st_tree::detail::node_raw<st_tree::tree<std::__1::basic_string<char>, st_tree::raw<st_tree::arg_unused>, std::__1::allocatorstd::__1::basic_string<char > >, std::__1::basic_string<char> >'
        if (rhs._default_constructed()) {
            ~~~ ^
/Users/jon/Downloads/st_tree-master/include/st_tree_nodes.h:302:15: note: in instantiation of member function 'st_tree::detail::node_raw<st_tree::tree<std::__1::basic_string<char>, st_tree::raw<st_tree::arg_unused>, std::__1::allocatorstd::__1::basic_string<char > >, std::__1::basic_string<char> >::operator=' requested here
        _this = src; 
              ^
In file included from /Users/jon/Downloads/st_tree-master/examples/x06_graft.cpp:22:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:439:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/algorithm:628:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:1696:31: note: in instantiation of member function 'st_tree::detail::node_raw<st_tree::tree<std::__1::basic_string<char>, st_tree::raw<st_tree::arg_unused>, std::__1::allocatorstd::__1::basic_string<char > >, std::__1::basic_string<char> >::node_raw' requested here
            ::new((void_)__p) _Tp(__a0);
                              ^
In file included from /Users/jon/Downloads/st_tree-master/examples/x06_graft.cpp:28:
/Users/jon/Downloads/st_tree-master/include/st_tree.h:285:25: note: in instantiation of function template specialization 'std::__1::allocator<st_tree::detail::node_raw<st_tree::tree<std::__1::basic_string<char>, st_tree::raw<st_tree::arg_unused>, std::__1::allocatorstd::__1::basic_string<char > >, std::__1::basic_string<char> > >::construct<st_tree::detail::node_raw<st_tree::tree<std::__1::basic_string<char>, st_tree::raw<st_tree::arg_unused>, std::__1::allocatorstd::__1::basic_string<char > >, std::__1::basic_string<char> > >' requested here
        _node_allocator.construct(n, _node_init_val);
                        ^
/Users/jon/Downloads/st_tree-master/include/st_tree.h:189:17: note: in instantiation of member function 'st_tree::treestd::__1::basic_string<char, st_tree::raw<st_tree::arg_unused>, std::__1::allocatorstd::__1::basic_string<char > >::_new_node' requested here
        _root = _new_node();
                ^
/Users/jon/Downloads/st_tree-master/examples/x06_graft.cpp:43:8: note: in instantiation of member function 'st_tree::treestd::__1::basic_string<char, st_tree::raw<st_tree::arg_unused>, std::__1::allocatorstd::__1::basic_string<char > >::insert' requested here
    t2.insert("T");
       ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
erikerlandson commented 8 years ago

@JonHodgson Thanks for reporting! If I'm reading the error fire-hose right, this is also a manifestation of #16. I have a candidate fix at PR #17. The previous reporter never responded, but I'm curious if you can test this PR before I officially merge it.

JonHodgson commented 8 years ago

@erikerlandson Sorry, but that was the PR I was building.

I've attached the full output of a build of the "test" project, in html format buildlog.html.zip

erikerlandson commented 8 years ago

@JonHodgson Sorry, I didn't catch that you tried the issue-16 branch.

It may be difficult for me to reproduce this as I don't have Xcode, however I see that Xcode uses the clang toolchain; if you can get me your Xcode version I might be able to build a corresponding version of clang on my linux box: https://en.wikipedia.org/wiki/Xcode#Toolchain_versions

If you want to play with making any protected members public to see if it causes the problem to go away, that might at least get you a workaround

erikerlandson commented 8 years ago

Just as a data point, my default clang successfully builds st_tree, but it is version 3.7.0

JonHodgson commented 8 years ago

I'm running Xcode 7.2.1, on Yosemite. And just in case it matters, boost 1.58.0

erikerlandson commented 8 years ago

My investigation into Xcode versions of clang suggests that there is, sadly, no well-defined mapping between Xcode releases and other clang releases. In lieu of that, I tried building st_tree against all the clang-3.x series, but I failed to reproduce the compile failure.

Clang did turn up some other errors in a few of my operator= methods, which I fixed. I also merged #17 and cut a new release: https://github.com/erikerlandson/st_tree/releases/tag/version_1.0.4

You might try that just to see what happens, although I have no evidence that it would fix this problem with Xcode.

erikerlandson commented 8 years ago

Regarding boost, I am also building against 1.58

A note on clang - they appear to be only maintaining the tips of their release branches, so for example the release_36 branch corresponds to 3.6.2, but I can't find a way to reconstruct 3.6.1, etc. So I have been building the most-recent minor release of each 3.x series

JonHodgson commented 8 years ago

That update didn't help much, but I think I've made progress. It looks like the issue isn't the compiler, it's the standard library. Apple uses the LLVM libcxx, which includes certain checks

https://llvm.org/svn/llvm-project/libcxx/trunk/include/vector

Note line in the definition of vector

    static_assert((is_same<typename allocator_type::value_type, value_type>::value),
                  "Allocator::value_type must be same type as value_type");

Now in your code, you have a bunch of places where you're declaring a vector with a different allocator to the value_type. You're using the Allocator declared for the tree, but that is an allocator for the tree value type.

e.g. vector<Unsigned, Alloc> _hist;

As a test I went through and commented out all those allocators, and most of the errors vanished. In fact right now it looks like the errors I still have are in the test code, not the tree code (though saying that I've commented out a lot of the tests, so maybe re-instantiating them will pop more issues).

JonHodgson commented 8 years ago

It turns out that the last errors I was getting were also from a mismatched allocator, this time in a deque Attached is a zip of source that builds fine with all tests passing. I've just commented out the allocators. source.zip

erikerlandson commented 8 years ago

@JonHodgson that is a great find, thanks for all your help! It has been interesting to see the errors that more recent releases of clang have found hiding in this code, even though I had it passing all my unit testing and valgrind with both g++ and clang++ a few years ago.

I can add llvm's version of libc++ to my clang build, which hopefully will enable me to reproduce this locally.

erikerlandson commented 8 years ago

@JonHodgson I believe I figured it out -- the gnu STL re-casts its allocator under the hood to the correct value type, but the clang/llvm incarnation is more picky and it wants the allocator type you pass in to already match the container's value type.

I pushed a change to master that provides allocator types that are aligned with corresponding container value types, so the clang/llvm libcxx is now happy.

JonHodgson commented 8 years ago

@erikerlandson Hi, sorry I didn't respond earlier but I was working on the windows version of my app. What you've done seems to have worked, successful compilation in XCode. Thanks.

erikerlandson commented 8 years ago

@JonHodgson that is great news. I'll close this issue. Thanks again for your work on diagnosing the problem!