Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
inglorion opened this issue Jun 5, 2024 · 0 comments · May be fixed by #47
Open

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

inglorion opened this issue Jun 5, 2024 · 0 comments · May be fixed by #47

Comments

@inglorion
Copy link

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.

@inglorion inglorion linked a pull request Jun 20, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant