Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add char_traits<uint8_t>#1820

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
placintaalexandru wants to merge1 commit intomicrosoft:master
base:master
Choose a base branch
Loading
fromplacintaalexandru:fix/Build-on-recent-libc++

Conversation

@placintaalexandru
Copy link

@placintaalexandruplacintaalexandru commentedApr 10, 2025
edited
Loading

Fixes1812

char_traits<uint8_t> type was not supplied

@placintaalexandru
Copy link
Author

@microsoft-github-policy-service agree

aminya added a commit to aminya/vcpkg that referenced this pull requestMay 5, 2025
Cpprestsdk fails to compile on newer MacOS due to missing char_traits.This provides the fix frommicrosoft/cpprestsdk#1820Related tomicrosoft/cpprestsdk#1812
aminya added a commit to aminya/vcpkg that referenced this pull requestMay 5, 2025
Cpprestsdk fails to compile on newer MacOS due to missing char_traits.This provides the fix frommicrosoft/cpprestsdk#1820Related tomicrosoft/cpprestsdk#1812
aminya added a commit to aminya/vcpkg that referenced this pull requestMay 5, 2025
Cpprestsdk fails to compile on newer MacOS due to missing char_traits.This provides the fix frommicrosoft/cpprestsdk#1820Related tomicrosoft/cpprestsdk#1812
aminya added a commit to aminya/vcpkg that referenced this pull requestMay 5, 2025
Cpprestsdk fails to compile on newer MacOS due to missing char_traits.This provides the fix frommicrosoft/cpprestsdk#1820Related tomicrosoft/cpprestsdk#1812
@BillyONeal
Copy link
Member

This PR introduces undefined behavior:https://eel.is/c++draft/requirements#namespace.std-2

There is no program-defined type here. This also fails if 2 libraries try to do this.

frederick-vs-ja reacted with thumbs up emoji

Copy link

@aminyaaminya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The definition needs to be guarded

@@ -0,0 +1,74 @@
#include <cstdint>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
#include<cstdint>
#pragma once
#include<cstddef>
#if (_LIBCPP_VERSION >=190000)
#include<cstdint>


static int_type eof() noexcept { return static_cast<int_type>(-1); }
};
} // namespace std

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
}// namespace std
}// namespace std
#endif// (_LIBCPP_VERSION >= 190000)

aminya added a commit to aminya/vcpkg that referenced this pull requestJun 6, 2025
Cpprestsdk fails to compile on newer MacOS due to missing char_traits.This provides the fix frommicrosoft/cpprestsdk#1820Related tomicrosoft/cpprestsdk#1812
aminya added a commit to aminya/vcpkg that referenced this pull requestJun 28, 2025
Cpprestsdk fails to compile on newer MacOS due to missing char_traits.This provides the fix frommicrosoft/cpprestsdk#1820Related tomicrosoft/cpprestsdk#1812
aminya added a commit to aminya/vcpkg that referenced this pull requestJul 5, 2025
Cpprestsdk fails to compile on newer MacOS due to missing char_traits.This provides the fix frommicrosoft/cpprestsdk#1820Related tomicrosoft/cpprestsdk#1812
aminya added a commit to aminya/vcpkg that referenced this pull requestJul 6, 2025
Cpprestsdk fails to compile on newer MacOS due to missing char_traits.This provides the fix frommicrosoft/cpprestsdk#1820Related tomicrosoft/cpprestsdk#1812
@frederick-vs-ja
Copy link

I guess a proper fix would be

  • introducing a customized traits type (shown ascustom_char_traits<uint8_t> later, but not necessary templatized),
  • usingbasic_string<uint8_t, custom_char_traits<uint8_t>> instead ofbasic_string<uint8_t>, and finally,
  • makingbasic_ostream::print a function template to accept different traits types.

@leakingmemory
Copy link

Using unsigned types with any of the string and stream templates is a can of worms. As far as I know the C++ standard does not mandate the standard library to support unsigned char types in those. I think ideally only the standard char types should be used, and applications using stream apis should convert from and to unsigned types if they need to in application code. But it would unfortunately be a breaking change.

@frederick-vs-ja
Copy link

As far as I know the C++ standard does not mandate the standard library to support unsigned char types in those.

basic_string is required to support using them as element types ([strings.general]/1). Butchar_traits, along with stream and locale stuffs, are not.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

1 more reviewer

@aminyaaminyaaminya requested changes

Reviewers whose approvals may not affect merge requirements

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Fails to build on recent libc++ (20 tested)

5 participants

@placintaalexandru@BillyONeal@frederick-vs-ja@leakingmemory@aminya

[8]ページ先頭

©2009-2025 Movatter.jp