Closed Bug 1849087 Opened 10 months ago Closed 10 months ago

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

Categories

(Core :: Security: PSM, defect)

defect

Tracking

()

RESOLVED FIXED
118 Branch
Tracking Status
firefox118 --- 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:19:52.564Z] 07:19:52     INFO -  In file included from /builds/worker/checkouts/gecko/security/manager/ssl/tests/gtest/HMACTest.cpp:1:
[task 2023-08-15T07:19:52.564Z] 07:19:52     INFO -  In file included from /builds/worker/workspace/obj-build/dist/stl_wrappers/string:54:
[task 2023-08-15T07:19:52.564Z] 07:19:52    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:19:52.564Z] 07:19:52     INFO -    723 |     static_assert(( is_same<_CharT, typename traits_type::char_type>::value),
[task 2023-08-15T07:19:52.564Z] 07:19:52     INFO -        |                                              ^
[task 2023-08-15T07:19:52.564Z] 07:19:52     INFO -  /builds/worker/checkouts/gecko/security/manager/ssl/tests/gtest/HMACTest.cpp:16:30: note: in instantiation of template class 'std::basic_string<unsigned char>' requested here
[task 2023-08-15T07:19:52.564Z] 07:19:52     INFO -     16 |   std::basic_string<uint8_t> expectedOutput;
[task 2023-08-15T07:19:52.564Z] 07:19:52     INFO -        |                              ^
[task 2023-08-15T07:19:52.564Z] 07:19:52     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:19:52.564Z] 07:19:52     INFO -     23 | struct _LIBCPP_TEMPLATE_VIS char_traits;
[task 2023-08-15T07:19:52.564Z] 07:19:52     INFO -        |                             ^
[task 2023-08-15T07:19:52.564Z] 07:19:52     INFO -  In file included from /builds/worker/checkouts/gecko/security/manager/ssl/tests/gtest/HMACTest.cpp:1:
[task 2023-08-15T07:19:52.564Z] 07:19:52     INFO -  In file included from /builds/worker/workspace/obj-build/dist/stl_wrappers/string:54:
[task 2023-08-15T07:19:52.564Z] 07:19:52     INFO -  In file included from /builds/worker/fetches/clang/bin/../i686-w64-mingw32/include/c++/v1/string:622:
[task 2023-08-15T07:19:52.564Z] 07:19:52    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:19:52.564Z] 07:19:52     INFO -    294 |     static_assert((is_same<_CharT, typename traits_type::char_type>::value),
[task 2023-08-15T07:19:52.564Z] 07:19:52     INFO -        |                                             ^
[task 2023-08-15T07:19:52.564Z] 07:19:52     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:19:52.564Z] 07:19:52     INFO -     30 | struct _LIBCPP_TEMPLATE_VIS is_convertible : public integral_constant<bool, __is_convertible(_T1, _T2)> {};
[task 2023-08-15T07:19:52.564Z] 07:19:52     INFO -        |                                                                                                      ^
[task 2023-08-15T07:19:52.564Z] 07:19:52     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:19:52.564Z] 07:19:52     INFO -    696 |       is_convertible<const _Tp&, basic_string_view<_CharT, _Traits> >::value &&
[task 2023-08-15T07:19:52.564Z] 07:19:52     INFO -        |       ^
[task 2023-08-15T07:19:52.564Z] 07:19:52     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:19:52.564Z] 07:19:52     INFO -   1036 |             __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
[task 2023-08-15T07:19:52.564Z] 07:19:52     INFO -        |                           ^
[task 2023-08-15T07:19:52.564Z] 07:19:52     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:19:52.564Z] 07:19:52     INFO -   1039 |   _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit basic_string(const _Tp& __t)
[task 2023-08-15T07:19:52.564Z] 07:19:52     INFO -        |                                                                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
[task 2023-08-15T07:19:52.564Z] 07:19:52     INFO -   1040 |       : __r_(__default_init_tag(), __default_init_tag()) {
[task 2023-08-15T07:19:52.564Z] 07:19:52     INFO -        |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[task 2023-08-15T07:19:52.564Z] 07:19:52     INFO -   1041 |     __self_view __sv = __t;
[task 2023-08-15T07:19:52.564Z] 07:19:52     INFO -        |     ~~~~~~~~~~~~~~~~~~~~~~~
[task 2023-08-15T07:19:52.564Z] 07:19:52     INFO -   1042 |     __init(__sv.data(), __sv.size());
[task 2023-08-15T07:19:52.564Z] 07:19:52     INFO -        |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[task 2023-08-15T07:19:52.564Z] 07:19:52     INFO -   1043 |   }
[task 2023-08-15T07:19:52.564Z] 07:19:52     INFO -        |   ~
[task 2023-08-15T07:19:52.564Z] 07:19:52     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:19:52.564Z] 07:19:52     INFO -    704 | class basic_string
[task 2023-08-15T07:19:52.564Z] 07:19:52     INFO -        |       ^
[task 2023-08-15T07:19:52.564Z] 07:19:52     INFO -  /builds/worker/checkouts/gecko/security/manager/ssl/tests/gtest/HMACTest.cpp:14:8: note: while declaring the implicit copy constructor for 'HMACTestCase'
[task 2023-08-15T07:19:52.564Z] 07:19:52     INFO -     14 | struct HMACTestCase {
[task 2023-08-15T07:19:52.564Z] 07:19:52     INFO -        |        ^
[task 2023-08-15T07:19:52.564Z] 07:19:52     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:19:52.564Z] 07:19:52     INFO -     23 | struct _LIBCPP_TEMPLATE_VIS char_traits;
[task 2023-08-15T07:19:52.564Z] 07:19:52     INFO -        |                             ^

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

Pushed by mh@glandium.org:
https://hg.mozilla.org/integration/autoland/rev/b790e8b2cdef
Avoid using basic_string<uint8_t>. r=jschanck

Backed out for causing gtest failures on psm_HMAC.Test

Backout link

Push with failures

Failure log

Flags: needinfo?(mh+mozilla)
Expected equality of these values:
  output[i]
    Which is: '\xB0' (176)
  testCase.expectedOutput[i]
    Which is: '\xB0' (176)

Haha, good one :)

Flags: needinfo?(mh+mozilla)
Pushed by mh@glandium.org:
https://hg.mozilla.org/integration/autoland/rev/afb502f90b21
Avoid using basic_string<uint8_t>. r=jschanck
Status: NEW → RESOLVED
Closed: 10 months ago
Resolution: --- → FIXED
Target Milestone: --- → 118 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: