Skip to content
This repository was archived by the owner on Aug 31, 2026. It is now read-only.
This repository was archived by the owner on Aug 31, 2026. It is now read-only.

undefined template 'std::char_traits<unsigned char>' #46

Description

@inglorion

Attempting to build dptf (revision 00b9ac1) with recent libc++ fails with errors like the following:

In file included from /tmp/dptf/DPTF/Sources/Libraries/ConfigurationFileContent/ConfigurationFileContent.cpp:21:
/tmp/dptf/DPTF/Linux/Libraries/../../Sources/ThirdParty/nlohmann_json/json.hpp:6221:19: error: implicit instantiation of undefined template 'std::char_traits<unsigned char>'                                                                                                   
 6221 |     typename std::char_traits<char_type>::int_type get_character()
      |                   ^
/tmp/dptf/DPTF/Linux/Libraries/../../Sources/ThirdParty/nlohmann_json/json.hpp:23789:19: note: in instantiation of template class 'nlohmann::detail::iterator_input_adapter<std::__wrap_iter<const unsigned char *>>' requested here
 23789 |         auto ia = detail::input_adapter(std::forward<InputType>(i));
       |                   ^
/tmp/dptf/DPTF/Sources/Libraries/ConfigurationFileContent/ConfigurationFileContent.cpp:137:21: note: in instantiation of function template specialization 'nlohmann::basic_json<>::from_bson<const std::vector<unsigned char> &>' requested here
  137 |                 auto data = json::from_bson(segment);
      |                                   ^
/usr/bin/../include/c++/v1/__fwd/string.h:23:29: note: template is declared here
   23 | struct _LIBCPP_TEMPLATE_VIS char_traits;
      |                             ^

A specialization of char_traits for char is required to exist, but not for unsigned char. Previously, libc++ had a default implementation of char_traits for arbitrary types, but this has been deprecated for some time and was removed in https://reviews.llvm.org/D157058. As a result, char_traits<unsigned char> now fails to compile.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions