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

Compilation fails due to the use of deprecated features #387

Open
yurivict opened this issue Jul 17, 2023 · 2 comments
Open

Compilation fails due to the use of deprecated features #387

yurivict opened this issue Jul 17, 2023 · 2 comments

Comments

@yurivict
Copy link

clang-16 default to C++20, and you use the deprecated feature std::char_traits, so the build, fails:


/wrkdirs/usr/ports/databases/nanodbc/work/nanodbc-2.14.0/nanodbc/nanodbc.cpp:263:25: error: '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. [-Werror,-Wdeprecated-declarations]
    auto const n = std::char_traits<NANODBC_SQLCHAR>::length(array);
                        ^
/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.")
       ^
/usr/include/c++/v1/__config:782:53: note: expanded from macro '_LIBCPP_DEPRECATED_'
#      define _LIBCPP_DEPRECATED_(m) __attribute__((deprecated(m)))
                                                    ^
/wrkdirs/usr/ports/databases/nanodbc/work/nanodbc-2.14.0/nanodbc/nanodbc.cpp:3566:52: error: '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. [-Werror,-Wdeprecated-declarations]
            dsn.name = string(&name[0], &name[std::char_traits<NANODBC_SQLCHAR>::length(name)]);
                                                   ^
/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.")
       ^
/usr/include/c++/v1/__config:782:53: note: expanded from macro '_LIBCPP_DEPRECATED_'
#      define _LIBCPP_DEPRECATED_(m) __attribute__((deprecated(m)))
                                                    ^
/wrkdirs/usr/ports/databases/nanodbc/work/nanodbc-2.14.0/nanodbc/nanodbc.cpp:3568:49: error: '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. [-Werror,-Wdeprecated-declarations]
                string(&driver[0], &driver[std::char_traits<NANODBC_SQLCHAR>::length(driver)]);
                                                ^
/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.")

Please replace deprecated features use with valid features, and add the compilation argument that sets the C++ standard level.

FreeBSD 14

@yurivict yurivict changed the title Compilation fails du to the use of deprecated features Compilation fails due to the use of deprecated features Jul 17, 2023
@mloskot
Copy link
Member

mloskot commented Jul 17, 2023

What is your NANODBC_SQLCHAR ?

add the compilation argument that sets the C++ standard level.

Pass your desired via CMAKE_CXX_STANDARD

@jbulow
Copy link

jbulow commented Mar 10, 2024

This is still an issue: (when compiling with libc++)

/build/nanodbc/nanodbc-2.14.0/nanodbc/nanodbc.cpp:306:25: error: implicit instantiation of undefined template 'std::char_traits<unsigned char>'
  306 |     auto const n = std::char_traits<NANODBC_SQLCHAR>::length(array);
      |                         ^
/usr/local/bin/../include/c++/v1/__string/char_traits.h:44:8: note: template is declared here
   44 | struct char_traits;
      |        ^
/build/nanodbc/nanodbc-2.14.0/nanodbc/nanodbc.cpp:4562:52: error: implicit instantiation of undefined template 'std::char_traits<unsigned char>'
 4562 |             dsn.name = string(&name[0], &name[std::char_traits<NANODBC_SQLCHAR>::length(name)]);
      |                                                    ^
/usr/local/bin/../include/c++/v1/__string/char_traits.h:44:8: note: template is declared here
   44 | struct char_traits;
      |        ^
/build/nanodbc/nanodbc-2.14.0/nanodbc/nanodbc.cpp:4564:49: error: implicit instantiation of undefined template 'std::char_traits<unsigned char>'
 4564 |                 string(&driver[0], &driver[std::char_traits<NANODBC_SQLCHAR>::length(driver)]);
      |                                                 ^
/usr/local/bin/../include/c++/v1/__string/char_traits.h:44:8: note: template is declared here
   44 | struct char_traits;
      |        ^
/build/nanodbc/nanodbc-2.14.0/nanodbc/nanodbc.cpp:4615:54: error: implicit instantiation of undefined template 'std::char_traits<unsigned char>'
 4615 |             drv.name = string(&descr[0], &descr[std::char_traits<NANODBC_SQLCHAR>::length(descr)]);
      |                                                      ^
/usr/local/bin/../include/c++/v1/__string/char_traits.h:44:8: note: template is declared here
   44 | struct char_traits;
      |        ^
4 errors generated.

I guess a solution similar to jtv/libpqxx#751 is needed.

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