Fix compile issue when the linking project is using C++23#3180
Merged
chenBright merged 1 commit intoapache:masterfrom Dec 31, 2025
Merged
Fix compile issue when the linking project is using C++23#3180chenBright merged 1 commit intoapache:masterfrom
chenBright merged 1 commit intoapache:masterfrom
Conversation
The root cause is unique_ptr has constexpr destructor since C++23
libcxx/include/__memory/unique_ptr.h:75:19: error: invalid application of 'sizeof' to an incomplete type 'brpc::RedisCommandHandler'
75 | static_assert(sizeof(_Tp) >= 0, "cannot delete an incomplete type");
| ^~~~~~~~~~~
libcxx/include/__memory/unique_ptr.h:290:7: note: in instantiation of member function 'std::default_delete<brpc::RedisCommandHandler>::operator()' requested here
290 | __deleter_(__tmp);
| ^
libcxx/include/__memory/unique_ptr.h:259:71: note: in instantiation of member function 'std::unique_ptr<brpc::RedisCommandHandler>::reset' requested here
259 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 ~unique_ptr() { reset(); }
| ^
src/brpc/redis.h:220:14: note: in instantiation of member function 'std::unique_ptr<brpc::RedisCommandHandler>::~unique_ptr' requested here
220 | explicit RedisConnContext(const RedisService* rs)
| ^
src/brpc/redis.h:190:7: note: forward declaration of 'brpc::RedisCommandHandler'
190 | class RedisCommandHandler;
Contributor
|
LGTM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The root cause is unique_ptr has constexpr destructor since C++23
libcxx/include/__memory/unique_ptr.h:75:19: error: invalid application of 'sizeof' to an incomplete type 'brpc::RedisCommandHandler'
75 | static_assert(sizeof(_Tp) >= 0, "cannot delete an incomplete type");
| ^~~~~~~~~~~
libcxx/include/__memory/unique_ptr.h:290:7: note: in instantiation of member function 'std::default_deletebrpc::RedisCommandHandler::operator()' requested here
290 | _deleter(__tmp);
| ^
libcxx/include/__memory/unique_ptr.h:259:71: note: in instantiation of member function 'std::unique_ptrbrpc::RedisCommandHandler::reset' requested here
259 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 ~unique_ptr() { reset(); }
| ^
src/brpc/redis.h:220:14: note: in instantiation of member function 'std::unique_ptrbrpc::RedisCommandHandler::~unique_ptr' requested here
220 | explicit RedisConnContext(const RedisService* rs)
| ^
src/brpc/redis.h:190:7: note: forward declaration of 'brpc::RedisCommandHandler'
190 | class RedisCommandHandler;
What problem does this PR solve?
Issue Number: resolve
Problem Summary:
What is changed and the side effects?
Changed:
Side effects:
Performance effects:
Breaking backward compatibility:
Check List: