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

GCC 13 build fails due to multiple: warning: 'template<long unsigned int _Len, long unsigned int _Align> struct std::aligned_storage' is deprecated [-Wdeprecated-declarations] #418

Closed
eitlane opened this issue Mar 24, 2023 · 5 comments

Comments

@eitlane
Copy link

eitlane commented Mar 24, 2023

Hi all,

Compiling jsoncons 0.170.0 with gcc 13 (x86_64, linux, build from 12 March commit: f23dc726875c26f2c38dfded453aa9beba0b9be9) build fails with multiple errors like:

/include/jsoncons/detail/string_wrapper.hpp:101:31: warning: 'template<long unsigned int _Len, long unsigned int _Align> struct std::aligned_storage' is deprecated [-Wdeprecated-declarations]
         typedef typename std::aligned_storage<sizeof(storage_t), alignof(storage_t)>::type json_storage_kind;
                                         ^~~~~~~~~~~~~~~
 In file included from /include/c++/13.0.1/bits/char_traits.h:50,
                  from /include/c++/13.0.1/string:42,
                  from /jsoncons-0.170.0/include/jsoncons/basic_json.hpp:11:
/include/c++/13.0.1/type_traits:2099:5: note: declared here
         aligned_storage
         ^~~~~~~~~~~~~~~

Once I removed -Werror from the cmake file, the project compiled successfully.

Thanks
V

@eitlane eitlane added the Bug label Mar 24, 2023
@danielaparker
Copy link
Owner

Thanks for reporting this. Yes, C++23 is deprecating std::aligned_storage, which jsoncons uses for a structure for storing string data, because std::aligned_* suffers from many poor API design decisions. We'll be investigating a replacement for the next release.

@danielaparker
Copy link
Owner

Fixed on master.

@eitlane
Copy link
Author

eitlane commented Mar 26, 2023

Hello @danielaparker

Thanks a lot for the fast response. I wish everybody responds as fast as you :)

I applied the patch on my side but it still fails (much further though - 76% instead of 6%)

Here is the error:

[ 76%] Building CXX object test/CMakeFiles/unit_tests.dir/corelib/src/json_storage_tests.cpp.o
In file included from jsoncons-0.170.0/test/corelib/src/json_reader_tests.cpp:7:
jsoncons-0.170.0/test/corelib/src/freelist_allocator.hpp:20:23: error: 'template<long unsigned int _Len, long unsigned int _Align> struct std::aligned_storage' is deprecated [-Werror=deprecated-declarations]
   20 |         typename std::aligned_storage<sizeof(T), alignof(T)>::type storage;
      |                       ^~~~~~~~~~~~~~~
In file included from  include/c++/13.0.1/bits/char_traits.h:50,
                 from  include/c++/13.0.1/string:42,
                 from  jsoncons-0.170.0/include/jsoncons/basic_json.hpp:11,
                 from  jsoncons-0.170.0/include/jsoncons/json.hpp:10,
                 from  jsoncons-0.170.0/test/corelib/src/json_reader_tests.cpp:4:
 include/c++/13.0.1/type_traits:2099:5: note: declared here
 2099 |     aligned_storage
      |     ^~~~~~~~~~~~~~~

Am I doing something wrong ?

Thanks,
V

@danielaparker
Copy link
Owner

You're right, I fixed the one in the jsoncons library, but there were a couple of additional ones in the test code, and one in the third party catch.hpp header. I updated to the latest catch.hpp, which fixed its issue, and fixed the rest. Fixes are on master.

@eitlane
Copy link
Author

eitlane commented Mar 27, 2023

After applying the patches the build is green. :) Thanks for the reactive support
V

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants