Uploaded image for project: 'C++ Driver'
  1. C++ Driver
  2. CXX-2121

Compilation error with libc++ and C++ 17

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.6.1
    • Affects Version/s: 3.6.0
    • Component/s: Build
    • None
    • Environment:
      Using clang 10 on Debian and pass in -DCMAKE_CXX_STANDARD=17 and -DCMAKE_CXX_FLAGS="-stdlib=libc++"

      I get this:

      In file included from /home/gho/code/pc3-mongo-cxx-driver/src/mongocxx/options/auto_encryption.cpp:15:
      In file included from /home/gho/code/pc3-mongo-cxx-driver/src/mongocxx/options/auto_encryption.hpp:17:
      In file included from /home/gho/code/pc3-mongo-cxx-driver/src/bsoncxx/document/view_or_value.hpp:17:
      In file included from /home/gho/code/pc3-mongo-cxx-driver/src/bsoncxx/document/value.hpp:18:
      In file included from /usr/lib/llvm-10/bin/../include/c++/v1/memory:657:
      /usr/lib/llvm-10/bin/../include/c++/v1/utility:305:9: error: implicit instantiation of undefined template 'std::_1::basic_string<char, std::1::char_traits<char>, std::_1::allocator<char> >'
      _T1 first;
      ^
      /usr/lib/llvm-10/bin/../include/c++/v1/type_traits:3035:38: note: in instantiation of template class 'std::_1::pair<std::1::basic_string<char, std::1::char_traits<char>, std::1::allocator<char> >, std::1::basic_string<char, std::1::char_traits<char>, std::_1::allocator<char> > >' requested here
      : public integral_constant<bool, __is_trivially_destructible(_Tp)> {};
      ^
      /usr/lib/llvm-10/bin/../include/c++/v1/optional:538:5: note: in instantiation of template class 'std::_1::is_trivially_destructible<std::1::pair<std::1::basic_string<char, std::1::char_traits<char>, std::1::allocator<char> >, std::1::basic_string<char, std::1::char_traits<char>, std::_1::allocator<char> > > >' requested here
      is_trivially_destructible<_Tp>::value &&
      ^
      /usr/lib/llvm-10/bin/../include/c++/v1/optional:585:15: note: in instantiation of default argument for '_optional_move_assign_base<std::1::pair<std::1::basic_string<char, std::1::char_traits<char>, std::1::allocator<char> >, std::1::basic_string<char, std::1::char_traits<char>, std::_1::allocator<char> > > >' required here
      : private __optional_move_assign_base<_Tp>
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      /home/gho/code/pc3-mongo-cxx-driver/src/mongocxx/options/auto_encryption.hpp:254:29: note: in instantiation of template class 'std::_1::optional<std::1::pair<std::1::basic_string<char, std::1::char_traits<char>, std::1::allocator<char> >, std::1::basic_string<char, std::1::char_traits<char>, std::_1::allocator<char> > > >' requested here
      stdx::optional<ns_pair> _key_vault_namespace;
      ^
      /usr/lib/llvm-10/bin/../include/c++/v1/iosfwd:209:32: note: template is declared here
      class _LIBCPP_TEMPLATE_VIS basic_string;
      ^

        1. make-output.txt
          87 kB
        2. cmake-output.txt
          2 kB

            Assignee:
            roberto.sanchez@mongodb.com Roberto Sanchez
            Reporter:
            magnus.l.hakansson@gmail.com Magnus Håkansson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: