Skip to content

[struct_pack] fix c++17 enable_if missing ::type and wrong std::string_view type in user_defined_serialization_imp#1163

Merged
poor-circle merged 1 commit intoalibaba:mainfrom
songqing:fix/user-defined-serialization
Apr 3, 2026
Merged

[struct_pack] fix c++17 enable_if missing ::type and wrong std::string_view type in user_defined_serialization_imp#1163
poor-circle merged 1 commit intoalibaba:mainfrom
songqing:fix/user-defined-serialization

Conversation

@songqing
Copy link
Copy Markdown
Contributor

@songqing songqing commented Apr 1, 2026

Why

Issue 1: In the C++17 fallback path, sp_get_needed_size is incorrectly checked as returning std::string_view, while the C++20 version clearly requires it to return std::size_t. The type is completely wrong.

Issue 2: In std::void_tstd::enable_if, std::enable_if itself is a valid type (it just doesn’t have a ::type member), so std::void_t will never fail on it. This makes the condition check completely ineffective.

The correct form should be std::enable_if_t or typename std::enable_if::type, so that when condition == false it actually triggers a SFINAE substitution failure.

What is changing

Example

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 1, 2026

CLA assistant check
All committers have signed the CLA.

…g_view type in user_defined_serialization_imp
@songqing songqing force-pushed the fix/user-defined-serialization branch from b8a42b6 to 2f2b48a Compare April 1, 2026 00:57
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 1, 2026

for detail, goto summary download Artifacts base-ylt-cov-report(base commit coverage report) and ylt-cov-report(current pull request coverage report)

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 1, 2026

for detail, goto summary download Artifacts base-ylt-cov-report(base commit coverage report) and ylt-cov-report(current pull request coverage report)

@poor-circle
Copy link
Copy Markdown
Collaborator

LGTM

@poor-circle poor-circle merged commit e7e43b7 into alibaba:main Apr 3, 2026
29 of 31 checks passed
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.

3 participants