Clang und C++11



  • Hoi,
    Ich wollte mal testen ob mein GCC-Code auch ohne murren mit Clang läuft. Also mal das CMakeLists.txt angepasst:

    if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
    	set(CMAKE_CXX_FLAGS "-std=c++0x -Wall -Wextra -pedantic")
       set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
       set(CMAKE_CXX_FLAGS_RELEASE "-O3 -s -DNDEBUG")
    endif()
    

    Dann einfach unter Ubuntu 11.10 per Paketverwaltung clang installiert, Version 2.9 .

    Im C++03-Modus klappt das auch ganz gut, im C++11 Modus hängt er sich aber sofort an am ersten STL-Header auf:

    [ 12%] Building CXX object CMakeFiles/berry.dir/src/process_iterator.cpp.o
    In file included from /home/ethon/Projects/Berry/src/process_iterator.cpp:28:
    In file included from /home/ethon/Projects/Berry/include/berry/process_entry.hpp:28:
    In file included from /usr/include/c++/4.6/string:41:
    In file included from /usr/include/c++/4.6/bits/char_traits.h:40:
    In file included from /usr/include/c++/4.6/bits/stl_algobase.h:65:
    In file included from /usr/include/c++/4.6/bits/stl_pair.h:60:
    In file included from /usr/include/c++/4.6/bits/move.h:53:
    /usr/include/c++/4.6/type_traits:630:59: error: '_Tp' does not refer to a value
        : public integral_constant<bool, __is_standard_layout(_Tp)>
                                                              ^
    /usr/include/c++/4.6/type_traits:628:21: note: declared here
      template<typename _Tp>
                        ^
    /usr/include/c++/4.6/type_traits:631:8: error: expected class name
        { };
           ^
    /usr/include/c++/4.6/type_traits:631:8: error: expected '{' after base class list
    /usr/include/c++/4.6/type_traits:643:56: error: '_Tp' does not refer to a value
        : public integral_constant<bool, __is_literal_type(_Tp)>
                                                           ^
    /usr/include/c++/4.6/type_traits:641:21: note: declared here
      template<typename _Tp>
                        ^
    /usr/include/c++/4.6/type_traits:644:8: error: expected class name
        { };
           ^
    /usr/include/c++/4.6/type_traits:644:8: error: expected '{' after base class list
    /usr/include/c++/4.6/type_traits:647:56: error: expected function body after function declarator
        typename add_rvalue_reference<_Tp>::type declval() noexcept;
                                                           ^
    /usr/include/c++/4.6/type_traits:654:30: error: use of undeclared identifier 'declval'
            static decltype(_Tp1(declval<_Args1>()...), __one()) __test(int);
                                 ^
    /usr/include/c++/4.6/type_traits:654:38: error: '_Args1' does not refer to a value
            static decltype(_Tp1(declval<_Args1>()...), __one()) __test(int);
                                         ^
    /usr/include/c++/4.6/type_traits:653:43: note: declared here
          template<typename _Tp1, typename... _Args1>
                                              ^
    /usr/include/c++/4.6/type_traits:654:46: error: expected expression
            static decltype(_Tp1(declval<_Args1>()...), __one()) __test(int);
                                                 ^
    /usr/include/c++/4.6/type_traits:654:62: error: C++ requires a type specifier for all declarations
            static decltype(_Tp1(declval<_Args1>()...), __one()) __test(int);
            ~~~~~~                                               ^
    /usr/include/c++/4.6/type_traits:668:43: error: use of undeclared identifier 'declval'
            static decltype(static_cast<_Tp1>(declval<_Arg1>()), __one())
                                              ^
    /usr/include/c++/4.6/type_traits:668:51: error: '_Arg1' does not refer to a value
            static decltype(static_cast<_Tp1>(declval<_Arg1>()), __one())
                                                      ^
    /usr/include/c++/4.6/type_traits:667:40: note: declared here
          template<typename _Tp1, typename _Arg1>
                                           ^
    /usr/include/c++/4.6/type_traits:668:58: error: expected expression
            static decltype(static_cast<_Tp1>(declval<_Arg1>()), __one())
                                                             ^
    /usr/include/c++/4.6/type_traits:669:2: error: C++ requires a type specifier for all declarations
            __test(int);
            ^
    /usr/include/c++/4.6/type_traits:694:48: error: use of undeclared identifier 'declval'
        { static const bool __value = noexcept(_Tp(declval<_Args>()...)); };
                                                   ^
    /usr/include/c++/4.6/type_traits:694:56: error: '_Args' does not refer to a value
        { static const bool __value = noexcept(_Tp(declval<_Args>()...)); };
                                                           ^
    /usr/include/c++/4.6/type_traits:692:38: note: declared here
      template<typename _Tp, typename... _Args>
                                         ^
    /usr/include/c++/4.6/type_traits:694:63: error: expected expression
        { static const bool __value = noexcept(_Tp(declval<_Args>()...)); };
                                                                  ^
    /usr/include/c++/4.6/type_traits:699:61: error: use of undeclared identifier 'declval'
          static const bool __value = noexcept(static_cast<_Tp>(declval<_Arg>()));
                                                                ^
    fatal error: too many errors emitted, stopping now [-ferror-limit=]
    

    Hier steht ( http://clang.llvm.org/cxx_status.html ) :

    You can use Clang in C++11 mode either with libc++ or with gcc's libstdc++. Patches are needed to make libstdc++-4.4 and libstdc++-4.7 work with Clang in C++11 mode.

    Heißt das dass libstdc++-4.6 überhaupt nicht mit Clang funktioniert oder muss ich die nur nicht patchen?

    Erbitte Rat! 🙂
    Danke und Grüße,
    Ethon



  • Ich vermute mal, dass Version 2.9 einfach nicht den benötigten C++11 Support hat. Probiers doch mal mit 3.0 oder 3.1.



  • Ich benutze Clang 3.2 (Trunk) mit GCC 4.7. Bei mir funktionieren alle Header bis auf chrono und thread / mutex. Ich weis nicht, wie viel C++11 Clang 3.2 unterstützt. (Guck mal hier: http://clang.llvm.org/cxx_status.html). Vielleicht ist ja bei den GCC headern was dabei, das Clang nicht unterstützt?

    PS: Da ich gerade gesehen habe, das Clang 3.1 schon in [Testing] von archlinux ist, downgrade ich gerade 😃 (Clang 3.1 unterstützt alle von mir benötigten C++11 Features 🙂 )



  • Stimmt, mit Clang 3.0 kompiliert zumindestens der STL-Teil ... dafür hängt es jetzt bei Boost.Filesystem ... grr.



  • Kann jemand die Fehler zuordnen? Boost sollte mit Clang 3.0 auf jeden Fall kompilierbar sein, wie ich gelesen habe:

    [ 12%] Building CXX object CMakeFiles/berry.dir/src/linux/process.cpp.o
    In file included from /home/ethon/Berryfoo/src/linux/process.cpp:24:
    /home/ethon/Berryfoo/include/berry/detail/system.hpp:64:38: warning: no newline at end of file [-pedantic,-Wnewline-eof]
    #endif // __BERRY_DETAIL_SYSTEM_HPP__
                                         ^
    
    In file included from /home/ethon/Berryfoo/src/linux/process.cpp:43:
    In file included from /usr/include/boost/filesystem/path.hpp:31:
    In file included from /usr/include/boost/filesystem/v3/path.hpp:28:
    In file included from /usr/include/boost/iterator/iterator_facade.hpp:11:
    In file included from /usr/include/boost/iterator/interoperable.hpp:13:
    /usr/include/boost/type_traits/is_convertible.hpp:135:76: error: call to deleted constructor of 'boost::filesystem3::directory_iterator'
        static bool const value = sizeof( boost::detail::checker<To>::_m_check(_m_from, 0) )
                                                                               ^~~~~~~
    /usr/include/boost/type_traits/is_convertible.hpp:298:33: note: in instantiation of template class
          'boost::detail::is_convertible_basic_impl<boost::filesystem3::directory_iterator &, boost::filesystem3::directory_iterator>' requested here
                   ::boost::detail::is_convertible_basic_impl<ref_type,To>::value,
                                    ^
    /usr/include/boost/config/suffix.hpp:421:72: note: expanded from:
    #     define BOOST_STATIC_CONSTANT(type, assignment) static const type assignment
                                                                           ^
    /usr/include/boost/type_traits/is_convertible.hpp:371:13: note: in instantiation of template class 'boost::detail::is_convertible_impl<boost::filesystem3::directory_iterator,
          boost::filesystem3::directory_iterator>' requested here
       : public is_convertible_impl_dispatch_base<From, To>::type
                ^
    /usr/include/boost/type_traits/is_convertible.hpp:418:71: note: in instantiation of template class
          'boost::detail::is_convertible_impl_dispatch<boost::filesystem3::directory_iterator, boost::filesystem3::directory_iterator>' requested here
    BOOST_TT_AUX_BOOL_TRAIT_DEF2(is_convertible,From,To,(::boost::detail::is_convertible_impl_dispatch<From,To>::value))
                                                                          ^
    /usr/include/boost/type_traits/detail/bool_trait_def.hpp:81:30: note: expanded from:
        BOOST_TT_AUX_BOOL_C_BASE(C) \
                                 ^
    /usr/include/boost/type_traits/detail/bool_trait_def.hpp:63:74: note: expanded from:
    #   define BOOST_TT_AUX_BOOL_C_BASE(C) : ::boost::integral_constant<bool,C>
                                                                             ^
    /usr/include/boost/mpl/aux_/nested_type_wknd.hpp:27:7: note: in instantiation of template class 'boost::is_convertible<boost::filesystem3::directory_iterator,
          boost::filesystem3::directory_iterator>' requested here
        : T::type
          ^
    /usr/include/boost/mpl/aux_/preprocessed/gcc/or.hpp:51:11: note: in instantiation of template class
          'boost::mpl::aux::nested_type_wknd<boost::is_convertible<boost::filesystem3::directory_iterator, boost::filesystem3::directory_iterator> >' requested here
              BOOST_MPL_AUX_NESTED_TYPE_WKND(T1)::value
              ^
    /usr/include/boost/mpl/aux_/nested_type_wknd.hpp:38:24: note: expanded from:
        ::boost::mpl::aux::nested_type_wknd<T> \
                           ^
    /usr/include/boost/iterator/detail/enable_if.hpp:70:18: note: in instantiation of template class 'boost::mpl::or_<boost::is_convertible<boost::filesystem3::directory_iterator,
          boost::filesystem3::directory_iterator>, boost::is_convertible<boost::filesystem3::directory_iterator, boost::filesystem3::directory_iterator>, mpl_::bool_<false>,
          mpl_::bool_<false>, mpl_::bool_<false> >' requested here
          : enabled<(Cond::value)>::template base<Return>
                     ^
    /usr/include/boost/iterator/iterator_facade.hpp:80:9: note: in instantiation of template class
          'boost::iterators::enable_if<boost::mpl::or_<boost::is_convertible<boost::filesystem3::directory_iterator, boost::filesystem3::directory_iterator>,
          boost::is_convertible<boost::filesystem3::directory_iterator, boost::filesystem3::directory_iterator>, mpl_::bool_<false>, mpl_::bool_<false>, mpl_::bool_<false> >, bool>'
          requested here
          : ::boost::iterators::enable_if<
            ^
    /usr/include/boost/iterator/iterator_facade.hpp:837:3: note: in instantiation of template class 'boost::detail::enable_if_interoperable<boost::filesystem3::directory_iterator,
          boost::filesystem3::directory_iterator, bool>' requested here
      BOOST_ITERATOR_FACADE_RELATION(!=, return !, equal)
      ^
    /usr/include/boost/iterator/iterator_facade.hpp:829:3: note: expanded from:
      BOOST_ITERATOR_FACADE_INTEROP(                                    \
      ^
    /usr/include/boost/iterator/iterator_facade.hpp:815:3: note: expanded from:
      BOOST_ITERATOR_FACADE_INTEROP_HEAD(inline, op, result_type)                   \
      ^
    /usr/include/boost/iterator/iterator_facade.hpp:450:36: note: expanded from:
        prefix typename boost::detail::enable_if_interoperable<             \
                                       ^
    /usr/include/boost/iterator/iterator_facade.hpp:837:3: note: while substituting deduced template arguments into function template 'operator!=' [with Derived1 =
          boost::filesystem3::directory_iterator, V1 = , TC1 = , Reference1 = , Difference1 = , Derived2 = , V2 = boost::filesystem3::directory_iterator, TC2 = <no value>, Reference2
          = , Difference2 = <no value>]
      BOOST_ITERATOR_FACADE_RELATION(!=, return !, equal)
      ^
    /usr/include/boost/iterator/iterator_facade.hpp:829:3: note: expanded from:
      BOOST_ITERATOR_FACADE_INTEROP(                                    \
      ^
    /usr/include/boost/iterator/iterator_facade.hpp:815:3: note: expanded from:
      BOOST_ITERATOR_FACADE_INTEROP_HEAD(inline, op, result_type)                   \
      ^
    /usr/include/boost/iterator/iterator_facade.hpp:454:5: note: expanded from:
        operator op(                                                        \
        ^
    /usr/include/boost/filesystem/v3/operations.hpp:581:9: note: function has been explicitly marked deleted here
      class directory_iterator
            ^
    /usr/include/boost/type_traits/is_convertible.hpp:128:51: note: passing argument to parameter here
        static boost::type_traits::yes_type _m_check(T, int);
                                                      ^
    In file included from /home/ethon/Berryfoo/src/linux/process.cpp:45:
    In file included from /usr/include/boost/filesystem/operations.hpp:31:
    /usr/include/boost/filesystem/v3/operations.hpp:691:27: error: invalid operands to binary expression ('boost::filesystem3::directory_iterator' and
          'boost::filesystem3::directory_iterator')
            if (m_stack.top() != directory_iterator())
                ~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~
    /usr/include/boost/filesystem/v3/operations.hpp:699:50: error: invalid operands to binary expression ('boost::filesystem3::directory_iterator' and
          'boost::filesystem3::directory_iterator')
          while (!m_stack.empty() && ++m_stack.top() == directory_iterator())
                                     ~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~
    /usr/include/boost/filesystem/v3/operations.hpp:716:50: error: invalid operands to binary expression ('boost::filesystem3::directory_iterator' and
          'boost::filesystem3::directory_iterator')
          while (!m_stack.empty() && ++m_stack.top() == directory_iterator());
                                     ~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~
    /usr/include/boost/filesystem/v3/operations.hpp:742:32: error: invalid operands to binary expression ('boost::filesystem3::directory_iterator' and
          'boost::filesystem3::directory_iterator')
          if (m_imp->m_stack.top() == directory_iterator())
              ~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~
    /usr/include/boost/filesystem/v3/operations.hpp:753:32: error: invalid operands to binary expression ('boost::filesystem3::directory_iterator' and
          'boost::filesystem3::directory_iterator')
          if (m_imp->m_stack.top() == directory_iterator())
              ~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~
    /usr/include/boost/filesystem/v3/operations.hpp:763:32: error: invalid operands to binary expression ('boost::filesystem3::directory_iterator' and
          'boost::filesystem3::directory_iterator')
          if (m_imp->m_stack.top() == directory_iterator())
              ~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~
    In file included from /home/ethon/Berryfoo/src/linux/process.cpp:48:
    In file included from /home/ethon/Berryfoo/include/berry/process.hpp:34:
    /home/ethon/Berryfoo/include/berry/detail/process_detail.hpp:72:45: warning: no newline at end of file [-pedantic,-Wnewline-eof]
    #endif // __BERRY_DETAIL_PROCESSDETAIL_HPP__
                                                ^
    
    In file included from /home/ethon/Berryfoo/src/linux/process.cpp:48:
    /home/ethon/Berryfoo/include/berry/process.hpp:221:32: warning: no newline at end of file [-pedantic,-Wnewline-eof]
    #endif // __BERRY_PROCESS_HPP__
                                   ^
    
    In file included from /home/ethon/Berryfoo/src/linux/process.cpp:50:
    /home/ethon/Berryfoo/include/berry/process_entry.hpp:100:37: warning: no newline at end of file [-pedantic,-Wnewline-eof]
    #endif // __BERRY_PROCESSENTRY_HPP__
                                        ^
    
    In file included from /home/ethon/Berryfoo/src/linux/process.cpp:37:
    In file included from /usr/include/c++/4.6/string:42:
    In file included from /usr/include/c++/4.6/bits/allocator.h:48:
    In file included from /usr/include/c++/4.6/x86_64-linux-gnu/bits/c++allocator.h:34:
    /usr/include/c++/4.6/ext/new_allocator.h:114:23: error: call to deleted constructor of 'boost::filesystem3::directory_iterator'
            { ::new((void *)__p) _Tp(std::forward<_Args>(__args)...); }
                                 ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/include/c++/4.6/bits/vector.tcc:97:20: note: in instantiation of function template specialization
          '__gnu_cxx::new_allocator<boost::filesystem3::directory_iterator>::construct<boost::filesystem3::directory_iterator>' requested here
                this->_M_impl.construct(this->_M_impl._M_finish,
                              ^
    /usr/include/c++/4.6/bits/stl_vector.h:840:9: note: in instantiation of function template specialization 'std::vector<boost::filesystem3::directory_iterator,
          std::allocator<boost::filesystem3::directory_iterator> >::emplace_back<boost::filesystem3::directory_iterator>' requested here
          { emplace_back(std::move(__x)); }
            ^
    /usr/include/c++/4.6/bits/stl_stack.h:191:11: note: in instantiation of member function 'std::vector<boost::filesystem3::directory_iterator,
          std::allocator<boost::filesystem3::directory_iterator> >::push_back' requested here
          { c.push_back(std::move(__x)); }
              ^
    /usr/include/boost/filesystem/v3/operations.hpp:685:19: note: in instantiation of member function 'std::stack<boost::filesystem3::directory_iterator,
          std::vector<boost::filesystem3::directory_iterator, std::allocator<boost::filesystem3::directory_iterator> > >::push' requested here
              m_stack.push(directory_iterator(m_stack.top()->path()));
                      ^
    /usr/include/boost/filesystem/v3/operations.hpp:581:9: note: function has been explicitly marked deleted here
      class directory_iterator
            ^
    In file included from /home/ethon/Berryfoo/src/linux/process.cpp:43:
    In file included from /usr/include/boost/filesystem/path.hpp:31:
    In file included from /usr/include/boost/filesystem/v3/path.hpp:25:
    In file included from /usr/include/boost/filesystem/v3/path_traits.hpp:26:
    In file included from /usr/include/c++/4.6/vector:69:
    /usr/include/c++/4.6/bits/vector.tcc:319:18: error: functional-style cast from 'boost::filesystem3::directory_iterator' to 'boost::filesystem3::directory_iterator' uses deleted
          function
              *__position = _Tp(std::forward<_Args>(__args)...);
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/include/c++/4.6/bits/vector.tcc:102:4: note: in instantiation of function template specialization 'std::vector<boost::filesystem3::directory_iterator,
          std::allocator<boost::filesystem3::directory_iterator> >::_M_insert_aux<boost::filesystem3::directory_iterator>' requested here
              _M_insert_aux(end(), std::forward<_Args>(__args)...);
              ^
    /usr/include/c++/4.6/bits/stl_vector.h:840:9: note: in instantiation of function template specialization 'std::vector<boost::filesystem3::directory_iterator,
          std::allocator<boost::filesystem3::directory_iterator> >::emplace_back<boost::filesystem3::directory_iterator>' requested here
          { emplace_back(std::move(__x)); }
            ^
    /usr/include/c++/4.6/bits/stl_stack.h:191:11: note: in instantiation of member function 'std::vector<boost::filesystem3::directory_iterator,
          std::allocator<boost::filesystem3::directory_iterator> >::push_back' requested here
          { c.push_back(std::move(__x)); }
              ^
    /usr/include/boost/filesystem/v3/operations.hpp:685:19: note: in instantiation of member function 'std::stack<boost::filesystem3::directory_iterator,
          std::vector<boost::filesystem3::directory_iterator, std::allocator<boost::filesystem3::directory_iterator> > >::push' requested here
              m_stack.push(directory_iterator(m_stack.top()->path()));
                      ^
    /usr/include/boost/filesystem/v3/operations.hpp:581:9: note: candidate constructor (the implicit copy constructor) has been explicitly deleted
      class directory_iterator
            ^
    In file included from /home/ethon/Berryfoo/src/linux/process.cpp:37:
    In file included from /usr/include/c++/4.6/string:42:
    In file included from /usr/include/c++/4.6/bits/allocator.h:48:
    In file included from /usr/include/c++/4.6/x86_64-linux-gnu/bits/c++allocator.h:34:
    /usr/include/c++/4.6/ext/new_allocator.h:108:28: error: call to deleted constructor of 'boost::filesystem3::directory_iterator'
          { ::new((void *)__p) _Tp(__val); }
                               ^   ~~~~~
    /usr/include/c++/4.6/bits/vector.tcc:306:18: note: in instantiation of member function '__gnu_cxx::new_allocator<boost::filesystem3::directory_iterator>::construct' requested
          here
              this->_M_impl.construct(this->_M_impl._M_finish,
                            ^
    /usr/include/c++/4.6/bits/vector.tcc:102:4: note: in instantiation of function template specialization 'std::vector<boost::filesystem3::directory_iterator,
          std::allocator<boost::filesystem3::directory_iterator> >::_M_insert_aux<boost::filesystem3::directory_iterator>' requested here
              _M_insert_aux(end(), std::forward<_Args>(__args)...);
              ^
    /usr/include/c++/4.6/bits/stl_vector.h:840:9: note: in instantiation of function template specialization 'std::vector<boost::filesystem3::directory_iterator,
          std::allocator<boost::filesystem3::directory_iterator> >::emplace_back<boost::filesystem3::directory_iterator>' requested here
          { emplace_back(std::move(__x)); }
            ^
    /usr/include/c++/4.6/bits/stl_stack.h:191:11: note: in instantiation of member function 'std::vector<boost::filesystem3::directory_iterator,
          std::allocator<boost::filesystem3::directory_iterator> >::push_back' requested here
          { c.push_back(std::move(__x)); }
              ^
    /usr/include/boost/filesystem/v3/operations.hpp:685:19: note: in instantiation of member function 'std::stack<boost::filesystem3::directory_iterator,
          std::vector<boost::filesystem3::directory_iterator, std::allocator<boost::filesystem3::directory_iterator> > >::push' requested here
              m_stack.push(directory_iterator(m_stack.top()->path()));
                      ^
    /usr/include/boost/filesystem/v3/operations.hpp:581:9: note: function has been explicitly marked deleted here
      class directory_iterator
            ^
    In file included from /home/ethon/Berryfoo/src/linux/process.cpp:43:
    In file included from /usr/include/boost/filesystem/path.hpp:31:
    In file included from /usr/include/boost/filesystem/v3/path.hpp:29:
    In file included from /usr/include/boost/shared_ptr.hpp:17:
    /usr/include/boost/smart_ptr/shared_ptr.hpp:305:9: error: functional-style cast from 'const boost::shared_ptr<boost::filesystem3::detail::dir_itr_imp>' to 'this_type' (aka
          'shared_ptr<boost::filesystem3::detail::dir_itr_imp>') uses deleted function
            this_type(r).swap(*this);
            ^~~~~~~~~~~
    /usr/include/boost/filesystem/v3/operations.hpp:581:9: note: in instantiation of member function 'boost::shared_ptr<boost::filesystem3::detail::dir_itr_imp>::operator=' requested
          here
      class directory_iterator
            ^
    /usr/include/c++/4.6/bits/stl_algobase.h:578:14: note: in instantiation of function template specialization 'std::__copy_move_backward<true, false,
          std::random_access_iterator_tag>::__copy_move_b<boost::filesystem3::directory_iterator *, boost::filesystem3::directory_iterator *>' requested here
          return std::__copy_move_backward<_IsMove, __simple,
                 ^
    /usr/include/c++/4.6/bits/stl_algobase.h:588:19: note: in instantiation of function template specialization 'std::__copy_move_backward_a<true,
          boost::filesystem3::directory_iterator *, boost::filesystem3::directory_iterator *>' requested here
          return _BI2(std::__copy_move_backward_a<_IsMove>
                      ^
    /usr/include/c++/4.6/bits/stl_algobase.h:659:14: note: in instantiation of function template specialization 'std::__copy_move_backward_a2<true,
          boost::filesystem3::directory_iterator *, boost::filesystem3::directory_iterator *>' requested here
          return std::__copy_move_backward_a2<true>(std::__miter_base(__first),
                 ^
    /usr/include/c++/4.6/bits/vector.tcc:313:4: note: in instantiation of function template specialization 'std::move_backward<boost::filesystem3::directory_iterator *,
          boost::filesystem3::directory_iterator *>' requested here
              _GLIBCXX_MOVE_BACKWARD3(__position.base(),
              ^
    /usr/include/c++/4.6/bits/stl_algobase.h:664:48: note: expanded from:
    #define _GLIBCXX_MOVE_BACKWARD3(_Tp, _Up, _Vp) std::move_backward(_Tp, _Up, _Vp)
                                                   ^
    /usr/include/c++/4.6/bits/vector.tcc:102:4: note: in instantiation of function template specialization 'std::vector<boost::filesystem3::directory_iterator,
          std::allocator<boost::filesystem3::directory_iterator> >::_M_insert_aux<boost::filesystem3::directory_iterator>' requested here
              _M_insert_aux(end(), std::forward<_Args>(__args)...);
              ^
    /usr/include/c++/4.6/bits/stl_vector.h:840:9: note: in instantiation of function template specialization 'std::vector<boost::filesystem3::directory_iterator,
          std::allocator<boost::filesystem3::directory_iterator> >::emplace_back<boost::filesystem3::directory_iterator>' requested here
          { emplace_back(std::move(__x)); }
            ^
    /usr/include/c++/4.6/bits/stl_stack.h:191:11: note: in instantiation of member function 'std::vector<boost::filesystem3::directory_iterator,
          std::allocator<boost::filesystem3::directory_iterator> >::push_back' requested here
          { c.push_back(std::move(__x)); }
              ^
    /usr/include/boost/filesystem/v3/operations.hpp:685:19: note: in instantiation of member function 'std::stack<boost::filesystem3::directory_iterator,
          std::vector<boost::filesystem3::directory_iterator, std::allocator<boost::filesystem3::directory_iterator> > >::push' requested here
              m_stack.push(directory_iterator(m_stack.top()->path()));
                      ^
    /usr/include/boost/smart_ptr/shared_ptr.hpp:168:25: note: candidate constructor (the implicit copy constructor) has been explicitly deleted
    template<class T> class shared_ptr
                            ^
    /usr/include/boost/smart_ptr/shared_ptr.hpp:231:5: note: candidate constructor [with Y = boost::filesystem3::detail::dir_itr_imp]
        shared_ptr( shared_ptr<Y> const & r, typename boost::detail::sp_enable_if_convertible<Y,T>::type = boost::detail::sp_empty() )
        ^
    4 warnings and 11 errors generated.
    make[2]: *** [CMakeFiles/berry.dir/src/linux/process.cpp.o] Error 1
    make[1]: *** [CMakeFiles/berry.dir/all] Error 2
    make: *** [all] Error 2
    


  • Bei mir funktioniert es 🙂

    Scanning dependencies of target berry
    [ 12%] Building CXX object CMakeFiles/berry.dir/src/process_iterator.cpp.o
    [ 25%] Building CXX object CMakeFiles/berry.dir/src/process_entry.cpp.o
    [ 37%] Building CXX object CMakeFiles/berry.dir/src/process.cpp.o
    [ 50%] Building CXX object CMakeFiles/berry.dir/src/linux/process_entry.cpp.o
    [ 62%] Building CXX object CMakeFiles/berry.dir/src/linux/process.cpp.o
    Linking CXX shared library libberry.so
    [ 62%] Built target berry
    Scanning dependencies of target pyberry
    [ 75%] Building CXX object python/CMakeFiles/pyberry.dir/pyberry.cpp.o
    [ 87%] Building CXX object python/CMakeFiles/pyberry.dir/export_process_api.cpp.o
    Linking CXX shared library libpyberry.so
    [ 87%] Built target pyberry
    Scanning dependencies of target test_processes
    [100%] Building CXX object test/CMakeFiles/test_processes.dir/test_processes.cpp.o
    Linking CXX executable test_processes
    [100%] Built target test_processes
    

    EDIT: Es funktioniert sogar mit der neuen libc++ und libc++abi. 😃



  • Mit Clang 3.1 wenn ich dich korrekt verstanden habe?
    Aber wieso gibt es bei dir nicht die No-Newline-Warnung?



  • Ethon schrieb:

    Mit Clang 3.1 wenn ich dich korrekt verstanden habe?
    Aber wieso gibt es bei dir nicht die No-Newline-Warnung?

    Ja, Clang 3.1. Die Newline Warnung gehört bei Clang 3.1 zu -Wc++98-compat, also gibt es sie scheinbar in C++11 nicht mehr. Und du willst ja keine C++98-Kompatibilität, oder? Ich habe nochmal alles mit -Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic compiliert, hier ist das Ergebnis: https://gist.github.com/e1d8a48f68223328cba0
    Die clang: warning: -lc++abi: 'linker' input unused when '-c' is present kannst du ignorieren, das liegt daran, dass man bei CMake keine Linkerflags angeben kann, ich bei libc++ aber libc++abi linken muss.



  • Hmmm, Clang 3.2 steigt auch wegen Boost.Filesystem aus ... oO
    Welche Boost-Version hast du?



  • Ethon schrieb:

    Hmmm, Clang 3.2 steigt auch wegen Boost.Filesystem aus ... oO
    Welche Boost-Version hast du?

    Version : 1.49.0-2


Anmelden zum Antworten