Closed Bug 1849077 Opened 10 months ago Closed 10 months ago

error: implicit instantiation of undefined template 'std::char_traits<unsigned char>'

Categories

(NSS :: Test, defect)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: glandium, Assigned: glandium)

References

Details

Attachments

(1 file)

This error shows up on clang trunk. Ideally it would already appear as a deprecation warning in clang 16, but because char_traits is used through basic_string rather than directly, the deprecation warning doesn't happen.
See https://releases.llvm.org/16.0.0/projects/libcxx/docs/ReleaseNotes.html#upcoming-deprecations-and-removals

[task 2023-08-15T07:22:26.693Z] 07:22:26     INFO -  In file included from /builds/worker/checkouts/gecko/security/manager/ssl/tests/unit/tlsserver/lib/OCSPCommon.cpp:5:
[task 2023-08-15T07:22:26.693Z] 07:22:26     INFO -  In file included from /builds/worker/checkouts/gecko/security/manager/ssl/tests/unit/tlsserver/lib/OCSPCommon.h:11:
[task 2023-08-15T07:22:26.694Z] 07:22:26     INFO -  In file included from /builds/worker/workspace/obj-build/dist/include/ScopedNSSTypes.h:22:
[task 2023-08-15T07:22:26.695Z] 07:22:26     INFO -  In file included from /builds/worker/workspace/obj-build/dist/include/nsDebug.h:15:
[task 2023-08-15T07:22:26.695Z] 07:22:26     INFO -  In file included from /builds/worker/workspace/obj-build/dist/include/mozilla/DbgMacro.h:13:
[task 2023-08-15T07:22:26.696Z] 07:22:26     INFO -  In file included from /builds/worker/workspace/obj-build/dist/include/mozilla/Span.h:30:
[task 2023-08-15T07:22:26.697Z] 07:22:26     INFO -  In file included from /builds/worker/workspace/obj-build/dist/stl_wrappers/string:54:
[task 2023-08-15T07:22:26.697Z] 07:22:26    ERROR -  /builds/worker/fetches/clang/bin/../i686-w64-mingw32/include/c++/v1/string:723:46: error: implicit instantiation of undefined template 'std::char_traits<unsigned char>'
[task 2023-08-15T07:22:26.698Z] 07:22:26     INFO -    723 |     static_assert(( is_same<_CharT, typename traits_type::char_type>::value),
[task 2023-08-15T07:22:26.699Z] 07:22:26     INFO -        |                                              ^
[task 2023-08-15T07:22:26.700Z] 07:22:26     INFO -  /builds/worker/workspace/obj-build/dist/include/nss/mozpkix/test/pkixtestutil.h:41:62: note: in instantiation of template class 'std::basic_string<unsigned char>' requested here
[task 2023-08-15T07:22:26.700Z] 07:22:26     INFO -     41 | inline bool ENCODING_FAILED(const ByteString& bs) { return bs.empty(); }
[task 2023-08-15T07:22:26.701Z] 07:22:26     INFO -        |                                                              ^
[task 2023-08-15T07:22:26.702Z] 07:22:26     INFO -  /builds/worker/fetches/clang/bin/../i686-w64-mingw32/include/c++/v1/__fwd/string.h:23:29: note: template is declared here
[task 2023-08-15T07:22:26.703Z] 07:22:26     INFO -     23 | struct _LIBCPP_TEMPLATE_VIS char_traits;
[task 2023-08-15T07:22:26.703Z] 07:22:26     INFO -        |                             ^
[task 2023-08-15T07:22:26.705Z] 07:22:26     INFO -  In file included from /builds/worker/checkouts/gecko/security/manager/ssl/tests/unit/tlsserver/lib/OCSPCommon.cpp:5:
[task 2023-08-15T07:22:26.705Z] 07:22:26     INFO -  In file included from /builds/worker/checkouts/gecko/security/manager/ssl/tests/unit/tlsserver/lib/OCSPCommon.h:11:
[task 2023-08-15T07:22:26.705Z] 07:22:26     INFO -  In file included from /builds/worker/workspace/obj-build/dist/include/ScopedNSSTypes.h:22:
[task 2023-08-15T07:22:26.706Z] 07:22:26     INFO -  In file included from /builds/worker/workspace/obj-build/dist/include/nsDebug.h:15:
[task 2023-08-15T07:22:26.706Z] 07:22:26     INFO -  In file included from /builds/worker/workspace/obj-build/dist/include/mozilla/DbgMacro.h:13:
[task 2023-08-15T07:22:26.706Z] 07:22:26     INFO -  In file included from /builds/worker/workspace/obj-build/dist/include/mozilla/Span.h:30:
[task 2023-08-15T07:22:26.706Z] 07:22:26     INFO -  In file included from /builds/worker/workspace/obj-build/dist/stl_wrappers/string:54:
[task 2023-08-15T07:22:26.706Z] 07:22:26     INFO -  In file included from /builds/worker/fetches/clang/bin/../i686-w64-mingw32/include/c++/v1/string:622:
[task 2023-08-15T07:22:26.706Z] 07:22:26    ERROR -  /builds/worker/fetches/clang/bin/../i686-w64-mingw32/include/c++/v1/string_view:294:45: error: implicit instantiation of undefined template 'std::char_traits<unsigned char>'
[task 2023-08-15T07:22:26.706Z] 07:22:26     INFO -    294 |     static_assert((is_same<_CharT, typename traits_type::char_type>::value),
[task 2023-08-15T07:22:26.706Z] 07:22:26     INFO -        |                                             ^
[task 2023-08-15T07:22:26.706Z] 07:22:26     INFO -  /builds/worker/fetches/clang/bin/../i686-w64-mingw32/include/c++/v1/__type_traits/is_convertible.h:30:102: note: in instantiation of template class 'std::basic_string_view<unsigned char>' requested here
[task 2023-08-15T07:22:26.706Z] 07:22:26     INFO -     30 | struct _LIBCPP_TEMPLATE_VIS is_convertible : public integral_constant<bool, __is_convertible(_T1, _T2)> {};
[task 2023-08-15T07:22:26.706Z] 07:22:26     INFO -        |                                                                                                      ^
[task 2023-08-15T07:22:26.706Z] 07:22:26     INFO -  /builds/worker/fetches/clang/bin/../i686-w64-mingw32/include/c++/v1/string:696:7: note: in instantiation of template class 'std::is_convertible<const std::basic_string<unsigned char> &, std::basic_string_view<unsigned char>>' requested here
[task 2023-08-15T07:22:26.706Z] 07:22:26     INFO -    696 |       is_convertible<const _Tp&, basic_string_view<_CharT, _Traits> >::value &&
[task 2023-08-15T07:22:26.706Z] 07:22:26     INFO -        |       ^
[task 2023-08-15T07:22:26.706Z] 07:22:26     INFO -  /builds/worker/fetches/clang/bin/../i686-w64-mingw32/include/c++/v1/string:1036:27: note: in instantiation of template class 'std::__can_be_converted_to_string_view<unsigned char, std::char_traits<unsigned char>, std::basic_string<unsigned char>>' requested here
[task 2023-08-15T07:22:26.706Z] 07:22:26     INFO -   1036 |             __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
[task 2023-08-15T07:22:26.706Z] 07:22:26     INFO -        |                           ^
[task 2023-08-15T07:22:26.706Z] 07:22:26     INFO -  /builds/worker/fetches/clang/bin/../i686-w64-mingw32/include/c++/v1/string:1039:93: note: while substituting prior template arguments into non-type template parameter [with _Tp = std::basic_string<unsigned char>]
[task 2023-08-15T07:22:26.707Z] 07:22:26     INFO -   1039 |   _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit basic_string(const _Tp& __t)
[task 2023-08-15T07:22:26.707Z] 07:22:26     INFO -        |                                                                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
[task 2023-08-15T07:22:26.707Z] 07:22:26     INFO -   1040 |       : __r_(__default_init_tag(), __default_init_tag()) {
[task 2023-08-15T07:22:26.707Z] 07:22:26     INFO -        |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[task 2023-08-15T07:22:26.707Z] 07:22:26     INFO -   1041 |     __self_view __sv = __t;
[task 2023-08-15T07:22:26.707Z] 07:22:26     INFO -        |     ~~~~~~~~~~~~~~~~~~~~~~~
[task 2023-08-15T07:22:26.707Z] 07:22:26     INFO -   1042 |     __init(__sv.data(), __sv.size());
[task 2023-08-15T07:22:26.707Z] 07:22:26     INFO -        |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[task 2023-08-15T07:22:26.707Z] 07:22:26     INFO -   1043 |   }
[task 2023-08-15T07:22:26.707Z] 07:22:26     INFO -        |   ~
[task 2023-08-15T07:22:26.707Z] 07:22:26     INFO -  /builds/worker/fetches/clang/bin/../i686-w64-mingw32/include/c++/v1/string:704:7: note: while substituting deduced template arguments into function template 'basic_string' [with _Tp = std::basic_string<unsigned char>, $1 = (no value)]
[task 2023-08-15T07:22:26.707Z] 07:22:26     INFO -    704 | class basic_string
[task 2023-08-15T07:22:26.707Z] 07:22:26     INFO -        |       ^
[task 2023-08-15T07:22:26.707Z] 07:22:26     INFO -  /builds/worker/workspace/obj-build/dist/include/nss/mozpkix/test/pkixtestutil.h:84:8: note: while declaring the implicit copy constructor for 'TestPublicKeyAlgorithm'
[task 2023-08-15T07:22:26.707Z] 07:22:26     INFO -     84 | struct TestPublicKeyAlgorithm {
[task 2023-08-15T07:22:26.707Z] 07:22:26     INFO -        |        ^
[task 2023-08-15T07:22:26.707Z] 07:22:26     INFO -  /builds/worker/fetches/clang/bin/../i686-w64-mingw32/include/c++/v1/__fwd/string.h:23:29: note: template is declared here
[task 2023-08-15T07:22:26.707Z] 07:22:26     INFO -     23 | struct _LIBCPP_TEMPLATE_VIS char_traits;
[task 2023-08-15T07:22:26.707Z] 07:22:26     INFO -        |                             ^

etc.

Assignee: nobody → nobody
Component: Security: PSM → Test
Product: Core → NSS
Version: unspecified → other

It's actually not guaranteed to exist by the standard, and is actively
being removed from libc++ in LLVM 18.

This instead creates a subclass that exposes enough of what's needed.

Status: NEW → RESOLVED
Closed: 10 months ago
Resolution: --- → FIXED
Regressions: 1852179
Assignee: nobody → mh+mozilla
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: