googleapis / googleapis/google-cloud-cpp

Update HttpHeaderName conversion operators to satisfy MSVC

オープン
#16,171 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
type: cleanup
主要言語
C++
スター
659
フォーク
462
平均マージ
1日 2時間
マージ済み PR(30日)
89

説明

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

```

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

google/cloud/internal/http_header_test.cc、特に35行目で失敗しているアサーションから始め、そこから呼び出される HttpHeaderName の変換演算子を調べてください。MSVC で失敗を再現し、他のコンパイラとオーバーロードの動作を比較してください。テストが意図したカバレッジを弱めることなく MSVC でビルドに成功し、パスすれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
cpp
領域
networking
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
静か
明瞭さ
説明が足りない
初心者へのやさしさ
55/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。