Fix type_traits_test on platforms where char is unsigned#192
Open
singhc7 wants to merge 1 commit into
Open
Conversation
7 tasks
Author
|
Hi @yosupo06! Sorry to ping directly — I opened a small PR (#192) that fixes Whenever you have a moment, would appreciate a look. Happy to make any changes if you'd prefer a different approach. Thanks for maintaining ac-library! |
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.
Summary
Fixes the
static_assertintest/unittest/type_traits_test.cppthat assumescharis signed. On platforms wherecharis unsigned by default (e.g.aarch64-linux,ppc64),to_unsigned_t<char>resolves tocharrather thanunsigned char, and the original assertion fails to compile.Guards the assertion with
CHAR_MIN < 0so the correct relationship is checked on each platform, and adds#include <climits>for the macro.The library itself is correct on these platforms — only this test assertion was platform-unsafe.
Changes
test/unittest/type_traits_test.cpp: add#include <climits>, guard theto_unsigned_t<char>assertion withCHAR_MIN < 0.Verification
Built and ran the full test suite on
aarch64-linux(where the failure originally manifested):The signed-char branch is the original upstream assertion, unchanged in behavior on platforms where
charis signed.Related
Closes #191