[SERVER-79426] MongoDB fails to compile on Clang-15 follow-up Created: 27/Jul/23  Updated: 29/Oct/23  Resolved: 31/Jul/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.1.0-rc0

Type: Task Priority: Major - P3
Reporter: Colin Stolley Assignee: Colin Stolley
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Participants:

 Description   

SERVER-77007 resolved one of the compilation problems in clang-15, but that masked other problems, namely:

 In file included from src/mongo/db/active_index_builds.cpp:30:
In file included from src/third_party/abseil-cpp/dist/absl/container/node_hash_map.h:39:
In file included from /bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/tuple:38:
In file included from /bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_pair.h:60:
/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/type_traits:910:7: error: static assertion failed due to requirement 'std::__is_complete_or_unbounded(std::__type_identity<std::pair<std::variant<mongo::KeyFieldname, std::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::variant<mongo::ProjectionPath, mongo::PositionalProjectionPath, mongo::SortPath>>, mongo::CNode>>{})': template argument must be a complete class or an unbounded array
      static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
      ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_construct.h:188:21: note: in instantiation of template class 'std::is_destructible<std::pair<std::variant<mongo::KeyFieldname, std::basic_string<char>, std::variant<mongo::ProjectionPath, mongo::PositionalProjectionPath, mongo::SortPath>>, mongo::CNode>>' requested here
      static_assert(is_destructible<_Value_type>::value,
                    ^
/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/alloc_traits.h:850:7: note: in instantiation of function template specialization 'std::_Destroy<std::pair<std::variant<mongo::KeyFieldname, std::basic_string<char>, std::variant<mongo::ProjectionPath, mongo::PositionalProjectionPath, mongo::SortPath>>, mongo::CNode> *>' requested here
      _Destroy(__first, __last);
      ^
/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_vector.h:730:7: note: in instantiation of function template specialization 'std::_Destroy<std::pair<std::variant<mongo::KeyFieldname, std::basic_string<char>, std::variant<mongo::ProjectionPath, mongo::PositionalProjectionPath, mongo::SortPath>>, mongo::CNode> *, std::pair<std::variant<mongo::KeyFieldname, std::basic_string<char>, std::variant<mongo::ProjectionPath, mongo::PositionalProjectionPath, mongo::SortPath>>, mongo::CNode>>' requested here
        std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,
             ^
/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_construct.h:88:15: note: in instantiation of member function 'std::vector<std::pair<std::variant<mongo::KeyFieldname, std::basic_string<char>, std::variant<mongo::ProjectionPath, mongo::PositionalProjectionPath,
mongo::SortPath>>, mongo::CNode>>::~vector' requested here
        __location->~_Tp();
                     ^
/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_construct.h:149:12: note: in instantiation of function template specialization 'std::destroy_at<std::vector<std::pair<std::variant<mongo::KeyFieldname, std::basic_string<char>, std::variant<mongo::ProjectionPath, mongo::PositionalProjectionPath, mongo::SortPath>>, mongo::CNode>>>' requested here
      std::destroy_at(__pointer);
           ^
/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/variant:472:11: note: (skipping 30 contexts in backtrace; use -ftemplate-backtrace-limit=0 to see all)
            std::_Destroy(std::__addressof(__this_mem));
                 ^
/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/type_traits:178:36: note: in instantiation of template class 'std::__and_<std::__is_implicitly_default_constructible<std::variant<mongo::KeyFieldname, std::basic_string<char>, std::variant<mongo::ProjectionPath, mongo::PositionalProjectionPath, mongo::SortPath>>>, std::__is_implicitly_default_constructible<mongo::CNode>>' requested here
    : public __bool_constant<!bool(_Pp::value)>
                                   ^
/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_pair.h:226:16: note: in instantiation of template class 'std::__not_<std::__and_<std::__is_implicitly_default_constructible<std::variant<mongo::KeyFieldname, std::basic_string<char>, std::variant<mongo::ProjectionPath, mongo::PositionalProjectionPath, mongo::SortPath>>>, std::__is_implicitly_default_constructible<mongo::CNode>>>' requested here
      explicit(__not_<__and_<__is_implicitly_default_constructible<_T1>,
               ^
/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_vector.h:367:35: note: in instantiation of template class 'std::pair<std::variant<mongo::KeyFieldname, std::basic_string<char>, std::variant<mongo::ProjectionPath, mongo::PositionalProjectionPath, mongo::SortPath>>, mongo::CNode>' requested here
                      _M_impl._M_end_of_storage - _M_impl._M_start);
                                                ^
/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_vector.h:526:7: note: in instantiation of member function 'std::_Vector_base<std::pair<std::variant<mongo::KeyFieldname, std::basic_string<char>, std::variant<mongo::ProjectionPath, mongo::PositionalProjectionPath, mongo::SortPath>>, mongo::CNode>, std::allocator<std::pair<std::variant<mongo::KeyFieldname, std::basic_string<char>, std::variant<mongo::ProjectionPath, mongo::PositionalProjectionPath, mongo::SortPath>>, mongo::CNode>>>::~_Vector_base' requested here
      vector() = default;
      ^
src/mongo/db/cst/c_node.h:88:22: note: in defaulted default constructor for 'std::vector<std::pair<std::variant<mongo::KeyFieldname, std::basic_string<char>, std::variant<mongo::ProjectionPath, mongo::PositionalProjectionPath, mongo::SortPath>>, mongo::CNode>>' first required here
        return CNode{ObjectChildren{}};
                     ^
In file included from src/mongo/db/active_index_builds.cpp:30:
In file included from src/third_party/abseil-cpp/dist/absl/container/node_hash_map.h:43:
In file included from src/third_party/abseil-cpp/dist/absl/algorithm/container.h:51:
In file included from /bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/vector:63:
/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_uninitialized.h:125:4: error: no matching function for call to '_Destroy'
          std::_Destroy(__result, __cur);
          ^~~~~~~~~~~~~
/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_uninitialized.h:370:14: note: in instantiation of function template specialization 'std::__do_uninit_copy<__gnu_cxx::__normal_iterator<const std::pair<std::variant<mongo::KeyFieldname, std::basic_string<char>, std::variant<mongo::ProjectionPath, mongo::PositionalProjectionPath, mongo::SortPath>>, mongo::CNode> *, std::vector<std::pair<std::variant<mongo::KeyFieldname, std::basic_string<char>, std::variant<mongo::ProjectionPath, mongo::PositionalProjectionPath, mongo::SortPath>>, mongo::CNode>>>, std::pair<std::variant<mongo::KeyFieldname, std::basic_string<char>, std::variant<mongo::ProjectionPath, mongo::PositionalProjectionPath, mongo::SortPath>>, mongo::CNode> *>' requested here
        return std::__do_uninit_copy(__first, __last, __result);
                    ^
/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_vector.h:601:9: note: in instantiation of function template specialization 'std::__uninitialized_copy_a<__gnu_cxx::__normal_iterator<const std::pair<std::variant<mongo::KeyFieldname, std::basic_string<char>, std::variant<mongo::ProjectionPath, mongo::PositionalProjectionPath, mongo::SortPath>>, mongo::CNode> *, std::vector<std::pair<std::variant<mongo::KeyFieldname, std::basic_string<char>, std::variant<mongo::ProjectionPath, mongo::PositionalProjectionPath, mongo::SortPath>>, mongo::CNode>>>, std::pair<std::variant<mongo::KeyFieldname, std::basic_string<char>, std::variant<mongo::ProjectionPath, mongo::PositionalProjectionPath, mongo::SortPath>>, mongo::CNode> *, std::pair<std::variant<mongo::KeyFieldname, std::basic_string<char>, std::variant<mongo::ProjectionPath, mongo::PositionalProjectionPath, mongo::SortPath>>, mongo::CNode>>' requested here
          std::__uninitialized_copy_a(__x.begin(), __x.end(),
               ^
/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/variant:284:6: note: in instantiation of member function 'std::vector<std::pair<std::variant<mongo::KeyFieldname, std::basic_string<char>, std::variant<mongo::ProjectionPath, mongo::PositionalProjectionPath, mongo::SortPath>>, mongo::CNode>>::vector' requested here
            _Type(std::forward<_Args>(__args)...);
            ^
/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/variant:385:4: note: in instantiation of function template specialization 'std::__detail::__variant::_Uninitialized<std::vector<std::pair<std::variant<mongo::KeyFieldname, std::basic_string<char>, std::variant<mongo::ProjectionPath, mongo::PositionalProjectionPath, mongo::SortPath>>, mongo::CNode>>, false>::_Uninitialized<const std::vector<std::pair<std::variant<mongo::KeyFieldname, std::basic_string<char>, std::variant<mongo::ProjectionPath, mongo::PositionalProjectionPath, mongo::SortPath>>, mongo::CNode>> &>' requested here
        : _M_first(in_place_index<0>, std::forward<_Args>(__args)...)
          ^
/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/variant:391:4: note: in instantiation of function template specialization 'std::__detail::__variant::_Variadic_union<std::vector<std::pair<std::variant<mongo::KeyFieldname, std::basic_string<char>, std::variant<mongo::ProjectionPath, mongo::PositionalProjectionPath, mongo::SortPath>>, mongo::CNode>>, mongo::CompoundInclusionKey, mongo::CompoundExclusionKey, mongo::CompoundInconsistentKey, mongo::KeyValue, std::variant<int, long long, double, mongo::Decimal128>, std::variant<mongo::AggregationPath, mongo::AggregationVariablePath>, double, std::basic_string<char>, mongo::BSONBinData, mongo::UserUndefined, mongo::OID, bool, mongo::Date_t, mongo::UserNull, mongo::BSONRegEx, mongo::BSONDBRef, mongo::BSONCode, mongo::BSONSymbol, mongo::BSONCodeWScope, int, mongo::Timestamp, long long, mongo::Decimal128, mongo::UserMinKey, mongo::UserMaxKey>::_Variadic_union<const std::vector<std::pair<std::variant<mongo::KeyFieldname, std::basic_string<char>, std::variant<mongo::ProjectionPath, mongo::PositionalProjectionPath, mongo::SortPath>>, mongo::CNode>> &>' requested here
        : _M_rest(in_place_index<_Np-1>, std::forward<_Args>(__args)...)
          ^
/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_construct.h:97:39: note: (skipping 19 contexts in backtrace; use -ftemplate-backtrace-limit=0 to see all)
    { return ::new((void*)__location) _Tp(std::forward<_Args>(__args)...); }
 
/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/variant:749:7: note: in defaulted copy constructor for 'std::__detail::__variant::_Move_assign_base<false, std::vector<mongo::CNode>, std::vector<std::pair<std::variant<mongo::KeyFieldname, std::basic_string<char>, std::variant<mongo::ProjectionPath, mongo::PositionalProjectionPath, mongo::SortPath>>, mongo::CNode>>, mongo::CompoundInclusionKey, mongo::CompoundExclusionKey, mongo::CompoundInconsistentKey, mongo::KeyValue, std::variant<int, long long, double, mongo::Decimal128>, std::variant<mongo::AggregationPath, mongo::AggregationVariablePath>, double, std::basic_string<char>, mongo::BSONBinData, mongo::UserUndefined, mongo::OID, bool, mongo::Date_t, mongo::UserNull, mongo::BSONRegEx, mongo::BSONDBRef, mongo::BSONCode, mongo::BSONSymbol, mongo::BSONCodeWScope, int, mongo::Timestamp, long long, mongo::Decimal128, mongo::UserMinKey, mongo::UserMaxKey>' first required here
      _Variant_base(const _Variant_base&) = default;
      ^
/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/variant:1403:7: note: in defaulted copy constructor for 'std::__detail::__variant::_Variant_base<std::vector<mongo::CNode>, std::vector<std::pair<std::variant<mongo::KeyFieldname, std::basic_string<char>, std::variant<mongo::ProjectionPath, mongo::PositionalProjectionPath, mongo::SortPath>>, mongo::CNode>>, mongo::CompoundInclusionKey, mongo::CompoundExclusionKey, mongo::CompoundInconsistentKey, mongo::KeyValue, std::variant<int, long long, double, mongo::Decimal128>, std::variant<mongo::AggregationPath, mongo::AggregationVariablePath>, double, std::basic_string<char>, mongo::BSONBinData, mongo::UserUndefined, mongo::OID, bool, mongo::Date_t, mongo::UserNull, mongo::BSONRegEx, mongo::BSONDBRef, mongo::BSONCode, mongo::BSONSymbol, mongo::BSONCodeWScope, int, mongo::Timestamp, long long, mongo::Decimal128, mongo::UserMinKey, mongo::UserMaxKey>' first required here
      variant(const variant& __rhs) = default;
      ^
src/mongo/db/cst/c_node.h:86:8: note: in defaulted copy constructor for 'std::variant<std::vector<mongo::CNode>, std::vector<std::pair<std::variant<mongo::KeyFieldname, std::basic_string<char>, std::variant<mongo::ProjectionPath, mongo::PositionalProjectionPath, mongo::SortPath>>, mongo::CNode>>, mongo::CompoundInclusionKey, mongo::CompoundExclusionKey, mongo::CompoundInconsistentKey, mongo::KeyValue, std::variant<int, long long, double, mongo::Decimal128>, std::variant<mongo::AggregationPath, mongo::AggregationVariablePath>, double, std::basic_string<char>, mongo::BSONBinData, mongo::UserUndefined, mongo::OID, bool, mongo::Date_t, mongo::UserNull, mongo::BSONRegEx, mongo::BSONDBRef, mongo::BSONCode, mongo::BSONSymbol, mongo::BSONCodeWScope, int, mongo::Timestamp, long long, mongo::Decimal128, mongo::UserMinKey, mongo::UserMaxKey>' first required here
struct CNode {
       ^
/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/unique_ptr.h:1065:34: note: in implicit copy constructor for 'mongo::CNode' first required here
    { return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); }
                                 ^
src/mongo/db/cst/compound_key.h:49:20: note: in instantiation of function template specialization 'std::make_unique<mongo::CNode, mongo::CNode &>' requested here
        : obj(std::make_unique<CNode>(*other.obj)) {}
                   ^
/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_construct.h:182:5: note: candidate template ignored: substitution failure [with _ForwardIterator = std::pair<std::variant<mongo::KeyFieldname, std::basic_string<char>, std::variant<mongo::ProjectionPath, mongo::PositionalProjectionPath, mongo::SortPath>>, mongo::CNode> *]
    _Destroy(_ForwardIterator __first, _ForwardIterator __last)
    ^
/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_construct.h:146:5: note: candidate function template not viable: requires single argument '__pointer', but 2 arguments were provided
    _Destroy(_Tp* __pointer)
    ^
/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/alloc_traits.h:832:5: note: candidate function template not viable: requires 3 arguments, but 2 were provided
    _Destroy(_ForwardIterator __first, _ForwardIterator __last,
    ^
/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/alloc_traits.h:847:5: note: candidate function template not viable: requires 3 arguments, but 2 were provided
    _Destroy(_ForwardIterator __first, _ForwardIterator __last,
    ^
2 errors generated. 

 



 Comments   
Comment by Colin Stolley [ 01/Aug/23 ]

Remaining zlib issue captured here: https://jira.mongodb.org/browse/SERVER-79591

Comment by Githook User [ 01/Aug/23 ]

Author:

{'name': 'Colin Stolley', 'email': 'colin.stolley@mongodb.com', 'username': 'ccstolley'}

Message: SERVER-79426: fix build issues under clang-15.
Branch: minh.luu-no_compile_sys-perf
https://github.com/mongodb/mongo/commit/eb02e5a121019b7dcdc28ebd4ec96e777075141e

Comment by Githook User [ 31/Jul/23 ]

Author:

{'name': 'Colin Stolley', 'email': 'colin.stolley@mongodb.com', 'username': 'ccstolley'}

Message: SERVER-79426: fix build issues under clang-15.
Branch: master
https://github.com/mongodb/mongo/commit/eb02e5a121019b7dcdc28ebd4ec96e777075141e

Generated at Thu Feb 08 06:40:56 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.