Skip to content

Update HttpHeaderName conversion operators to satisfy MSVC #16171

@scotthart

Description

@scotthart

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: '<function-style-cast>': 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<char,std::char_traits<char>,std::allocator<char>>::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<char,std::char_traits<char>,std::allocator<char>>::basic_string(const std::basic_string<char,std::char_traits<char>,std::allocator<char>> &)'
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.44.35207\include\xstring(1027): note: or       'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(std::basic_string<char,std::char_traits<char>,std::allocator<char>> &&) noexcept'
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.44.35207\include\xstring(768): note: or       'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::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<testing::internal::EqMatcher<std::string>>': 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<testing::internal::EqMatcher<std::string>>::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<testing::internal::EqMatcher<std::string>>::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

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: cleanupAn internal cleanup or hygiene concern.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions