`<sstream>`: basic_stringbuf C++20 constructors call _Getal()/_Release_to_buffer() breaks user specializations of basic_string
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 55/100
Hướng nghiên cứu
Bắt đầu trong phần triển khai , tại hàm dựng basic_stringbuf của C++20 gọi _Getal() và _Release_to_buffer(). Tái hiện chuyên biệt hóa tường minh basic_string được cung cấp với basic_istringstream, basic_ostringstream và basic_stringstream, sau đó xác minh rằng các trường hợp này biên dịch được trong C++20 mà không phụ thuộc vào các thành viên nội bộ MSVC đó.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Command-line test case
#include <sstream>
#include <string>
namespace std {
template<>
class basic_string<MyChar>
{ /* minimal impl */ };
}
// Triggers C2039: '_Getal' is not a member of std::basic_string<MyChar>
std::basic_istringstream<MyChar> s;
With /std:c++20, including and using std::basic_istringstream where std::basic_string is explicitly specialized produces:
C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.44.35207\include\sstream(50): error C2039: "_Getal" ist kein Member von "std::basic_string<MyChar,std::char_traits,std::allocator>".
Siehe Deklaration von "std::basic_string<MyChar,std::char_traits,std::allocator>"
The C++20 constructor basic_stringbuf(basic_string<E,T,A>&&, openmode) calls _Str._Getal() and subsequently _Str._Release_to_buffer(), both of which are MSVC-internal implementation details absent from user specializations. The same code compiles without error in C++17 mode and on GCC/Clang.
Expected behavior
Instantiating std::basic_istringstream<T>, std::basic_ostringstream<T>, or std::basic_stringstream<T> with a user-defined character type T whose std::basic_string<T> is explicitly specialized should compile without errors.
The C++ standard ([namespace.std] p2) permits adding explicit specializations of standard library class templates to namespace std for program-defined types, provided the specialization meets the standard library requirements for the original template. Footnote 140 further states:
"Any library code that instantiates other library templates must be prepared to work adequately with any user-supplied specialization that meets the minimum requirements of this document."
std::basic_stringbuf<T> is standard library code that instantiates std::basic_string<T>. It must therefore work with any conforming user specialization of std::basic_string<T>. The implementation should not require the presence of MSVC-internal methods (_Getal, _Release_to_buffer) that are not part of the std::basic_string interface mandated by the standard and that cannot be present on a user-provided specialization.
STL version
Microsoft (R) C/C++-Optimierungscompiler Version 19.44.35226 für x64
- Ngôn ngữ chính
- C++
- Star
- 11.2k
- Fork
- 1.7k
- Merge trung bình
- 4 ngày 4 giờ
- Pull request đã merge (30 ngày)
- 14
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/STL
-
LWG
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 2 ngày
-
generator LWG
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 2 ngày
-
LWG
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 2 ngày
-
`<__msvc_math.hpp>`: `_USE_MATH_DEFINES` is ignored after the first `<math.h>` include under `/Zc:cmath`Có thể đã có người làm @tiagomacarios đã nhận 10 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 2 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của microsoft/STL
Issue tương tự
-
bug data-types
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 71/100
ClickHouse/clickhouse-odbc#680 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
ionut-mihalache/aqua#31 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
needs-kind
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 63/100
villagesql/villagesql-server#1702 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
microsoft/vcpkg-tool#2191 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày