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

Avoid error: invalid application of 'sizeof' to an incomplete type 'rocksdb:xxx' when compiling with C++-23 #349

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mpatou-openai
Copy link
Collaborator

When trying to compile with c++-23 I'm getting errors like:

/usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/unique_ptr.h:91:16: error: invalid application of 'sizeof' to an incomplete type 'rocksdb::FragmentedRangeTombstoneList'
   91 |         static_assert(sizeof(_Tp)>0,
      |                       ^~~~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/unique_ptr.h:398:4: note: in instantiation of member function 'std::default_delete<rocksdb::FragmentedRangeTombstoneList>::operator()' requested here
  398 |           get_deleter()(std::move(__ptr));
      |           ^
cpp/third-party/rocksdb-cloud/db/range_tombstone_fragmenter.h:25:62: note: in instantiation of member function 'std::unique_ptr<rocksdb::FragmentedRangeTombstoneList>::~unique_ptr' requested here
   25 |   std::unique_ptr<FragmentedRangeTombstoneList> tombstones = nullptr;
      |                                                              ^
cpp/third-party/rocksdb-cloud/db/range_tombstone_fragmenter.h:20:8: note: forward declaration of 'rocksdb::FragmentedRangeTombstoneList'
   20 | struct FragmentedRangeTombstoneList;
      |        ^

With this fix declaration are reargenged to avoid this and when not possible we give explicit constructor/destructors and move them to a different place (ie. not in the headers).

@mpatou-openai mpatou-openai force-pushed the dev/mpatou/compile_cpp_23 branch from fe44b03 to 6a5f19f Compare January 22, 2025 18:50
@mpatou-openai mpatou-openai requested review from tudor and dhruba January 22, 2025 18:52
@mpatou-openai mpatou-openai marked this pull request as ready for review January 22, 2025 18:53
…rocksdb:xxx'` when compiling with C++-23

When trying to compile with c++-23 I'm getting errors like:

```
/usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/unique_ptr.h:91:16: error: invalid application of 'sizeof' to an incomplete type 'rocksdb::FragmentedRangeTombstoneList'
   91 |         static_assert(sizeof(_Tp)>0,
      |                       ^~~~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/unique_ptr.h:398:4: note: in instantiation of member function 'std::default_delete<rocksdb::FragmentedRangeTombstoneList>::operator()' requested here
  398 |           get_deleter()(std::move(__ptr));
      |           ^
cpp/third-party/rocksdb-cloud/db/range_tombstone_fragmenter.h:25:62: note: in instantiation of member function 'std::unique_ptr<rocksdb::FragmentedRangeTombstoneList>::~unique_ptr' requested here
   25 |   std::unique_ptr<FragmentedRangeTombstoneList> tombstones = nullptr;
      |                                                              ^
cpp/third-party/rocksdb-cloud/db/range_tombstone_fragmenter.h:20:8: note: forward declaration of 'rocksdb::FragmentedRangeTombstoneList'
   20 | struct FragmentedRangeTombstoneList;
      |        ^
```

With this fix declaration are reargenged to avoid this and when not possible we give explicit constructor/destructors and move them to a different place (ie. not in the headers).
@mpatou-openai mpatou-openai force-pushed the dev/mpatou/compile_cpp_23 branch from 6a5f19f to 674f6ce Compare January 22, 2025 21:35
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

Successfully merging this pull request may close these issues.

1 participant