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

Deprecated: char_traits<T> in LLVM 18 #738

Closed
nvanwyen opened this issue Oct 19, 2023 · 5 comments
Closed

Deprecated: char_traits<T> in LLVM 18 #738

nvanwyen opened this issue Oct 19, 2023 · 5 comments

Comments

@nvanwyen
Copy link

As of LLVM 18, the binarystring.hxx has a deprecation warning ...

In file included from /usr/local/include/pqxx/pqxx:4:
In file included from /usr/local/include/pqxx/array.hxx:26:
In file included from /usr/local/include/pqxx/connection.hxx:38:
In file included from /usr/local/include/pqxx/params.hxx:21:
In file included from /usr/local/include/pqxx/internal/statement_parameters.hxx:22:
/usr/local/include/pqxx/binarystring.hxx:62:27: warning: 'char_traits<unsigned char>' is deprecated: char_traits<T> for T not equal to char, wchar_t, char8_t, char16_t or char32_t is non-standard and is provided for a temporary period. It will be removed in LLVM 18, so please migrate off of it. [-Wdeprecated-declarations]
  using value_type = std::char_traits<char_type>::char_type;
                          ^
/Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk/usr/include/c++/v1/__string/char_traits.h:79:8: note: 'char_traits<unsigned char>' has been explicitly marked deprecated here
struct _LIBCPP_DEPRECATED_("char_traits<T> for T not equal to char, wchar_t, char8_t, char16_t or char32_t is non-standard and is provided for a temporary period. It will be removed in LLVM 18, so please migrate off of it.")
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk/usr/include/c++/v1/__config:836:53: note: expanded from macro '_LIBCPP_DEPRECATED_'
#      define _LIBCPP_DEPRECATED_(m) __attribute__((deprecated(m)))
@tt4g
Copy link
Contributor

tt4g commented Oct 19, 2023

Almost duplicate: #726

@jtv
Copy link
Owner

jtv commented Oct 20, 2023

Thanks for noting that @tt4g. Is it not fundamentally the same issue — "generic std::char_traits is deprecated"?

@jtv jtv changed the title Deprecated: char_traits<T> in LLVM 18 Deprecated: char_traits<T> in LLVM 18 Oct 21, 2023
@tt4g
Copy link
Contributor

tt4g commented Oct 21, 2023

From the following link, it appears that LLVM has made a decision to remove the definition of std::char_traits<T> which is not defined in the C++ standard.

As #726 quotes, the std::char_traits<T> is not being deprecated.
Only the definition of std::char_traits<T>, which is not defined in the C++ standard, is being removed.

Relevant changelog entry from LLVM 17:

The base template for std::char_traits has been marked as deprecated and will be removed in LLVM 18. If you are using std::char_traits with types other than char, wchar_t, char8_t, char16_t, char32_t or a custom character type for which you specialized std::char_traits, your code will stop working when we remove the base template. The Standard does not mandate that a base template is provided, and such a base template is bound to be incorrect for some types, which could currently cause unexpected behavior while going undetected.

@jtv
Copy link
Owner

jtv commented Oct 27, 2023

I think these are duplicates. I'll close this one. Workarounds are coming (one is: use std::vector<std::byte> instead) and in C++20, as of libpqxx 8.0, we'll have concepts so we can probably support "any type that's sufficiently similar."

@jtv jtv closed this as completed Oct 27, 2023
@nvanwyen
Copy link
Author

I made the temporary fix, using std::vector<std::byte> on my side and my testing is successful. Thank you, looking forward to pulling the latest for the permanent fix.

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

No branches or pull requests

3 participants