googleapis / googleapis/google-cloud-cpp
Update HttpHeaderName conversion operators to satisfy MSVC
- Ngôn ngữ chính
- C++
- Star
- 659
- Fork
- 462
- Merge trung bình
- 1 ngày 2 giờ
- Pull request đã merge (30 ngày)
- 89
Mô tả
MSVC produces errors other compilers do not. Is MSVC more correct? Unsure. Skip these tests in MSVC until we can figure out the more correct set of overloads for the conversion operators.
```
FAILED: [code=2] google/cloud/CMakeFiles/common_internal_http_header_test.dir/internal/http_header_test.cc.obj
sccache C:\PROGRA~1\MICROS~2\2022\ENTERP~1\VC\Tools\MSVC\1444~1.352\bin\Hostx64\x64\cl.exe /nologo /TP -DABSL_CONSUME_DLL -DGOOGLE_CLOUD_CPP_HAVE_GETRUSAGE=0 -DGOOGLE_CLOUD_CPP_HAVE_RUSAGE_THREAD=0 -DGTEST_LINKED_AS_SHARED_LIBRARY=1 -DNOMINMAX -DOPENTELEMETRY_ABI_VERSION_NO=1 -DOPENTELEMETRY_STL_VERSION=2017 -ID:\a\google-cloud-cpp\google-cloud-cpp -external:IC:\b\vcpkg_installed\x64-windows\include -external:IC:\b -external:W0 /DWIN32 /D_WINDOWS /EHsc /O2 /Ob2 /DNDEBUG -std:c++17 -MD /bigobj /experimental:external /external:W0 /external:anglebrackets /W3 /wd4996 /WX /showIncludes /Fogoogle\cloud\CMakeFiles\common_internal_http_header_test.dir\internal\http_header_test.cc.obj /Fdgoogle\cloud\CMakeFiles\common_internal_http_header_test.dir\ /FS -c D:\a\google-cloud-cpp\google-cloud-cpp\google\cloud\internal\http_header_test.cc
D:\a\google-cloud-cpp\google-cloud-cpp\google\cloud\internal\http_header_test.cc(35): error C2440: '': cannot convert from 'google::cloud::rest_internal::v3_6::HttpHeaderName' to 'std::string'
D:\a\google-cloud-cpp\google-cloud-cpp\google\cloud\internal\http_header_test.cc(35): note: 'std::basic_string,std::allocator>::basic_string': ambiguous call to overloaded function
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.44.35207\include\xstring(716): note: could be 'std::basic_string,std::allocator>::basic_string(const std::basic_string,std::allocator> &)'
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.44.35207\include\xstring(1027): note: or 'std::basic_string,std::allocator>::basic_string(std::basic_string,std::allocator> &&) noexcept'
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.44.35207\include\xstring(768): note: or 'std::basic_string,std::allocator>::basic_string(const _Elem *const )'
with
[
_Elem=char
]
D:\a\google-cloud-cpp\google-cloud-cpp\google\cloud\internal\http_header_test.cc(35): note: while trying to match the argument list '(google::cloud::rest_internal::v3_6::HttpHeaderName)'
D:\a\google-cloud-cpp\google-cloud-cpp\google\cloud\internal\http_header_test.cc(35): error C3889: call to object of class type 'testing::internal::PredicateFormatterFromMatcher>': no matching call operator found
C:\b\vcpkg_installed\x64-windows\include\gmock/gmock-matchers.h(1644): note: could be 'testing::AssertionResult testing::internal::PredicateFormatterFromMatcher>::operator ()(const char *,const T &) const'
D:\a\google-cloud-cpp\google-cloud-cpp\google\cloud\internal\http_header_test.cc(35): note: 'testing::AssertionResult testing::internal::PredicateFormatterFromMatcher>::operator ()(const char *,const T &) const': expects 2 arguments - 1 provided
D:\a\google-cloud-cpp\google-cloud-cpp\google\cloud\internal\http_header_test.cc(35): error C2737: 'gtest_ar': const object must be initialized
```
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu với google/cloud/internal/http_header_test.cc, đặc biệt là assertion bị lỗi ở dòng 35, và kiểm tra các toán tử chuyển đổi của HttpHeaderName mà assertion này thực thi. Tái hiện lỗi với MSVC và so sánh hành vi của các overload với các compiler khác; công việc được xem là hoàn tất khi test build và pass trên MSVC mà không làm suy yếu mức độ bao phủ mà test hướng tới.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- cpp
- Lĩnh vực
- networking
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 55/100