[ 
https://issues.apache.org/jira/browse/MESOS-9718?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16814600#comment-16814600
 ] 

Joseph Wu edited comment on MESOS-9718 at 4/10/19 4:10 PM:
-----------------------------------------------------------

Looks like this error occurs because in C+\+20, a string literal like 
{{u8"..."}} translates into a {{const char8_t[N]}}, whereas in earlier C++ 
versions, the same expression gives a {{const char[N]}} type. We can implicitly 
convert to {{std::string}} from {{const char[N]}}, but not from {{const 
char8_t[N]}}, which should be held by a {{std::u8string}}.

I'm not sure if there is a quick fix for this, since we're still on C++14 or so.

Here's some further reading:
 [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0482r3.html]


was (Author: kaysoky):
Looks like this error occurs because in C++20, a string literal like 
{{u8"..."}} translates into a {{const char8_t[N]}}, whereas in earlier C++ 
versions, the same expression gives a {{const char[N]}} type.  We can 
implicitly convert to {{std::string}} from {{const char[N]}}, but not from 
{{const char8_t[N]}}, which should be held by a {{std::u8string}}.

I'm not sure if there is a quick fix for this, since we're still on C++14 or so.

Here's some further reading:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0482r3.html

> Compile failures with char8_t by MSVC under /std:c++latest mode
> ---------------------------------------------------------------
>
>                 Key: MESOS-9718
>                 URL: https://issues.apache.org/jira/browse/MESOS-9718
>             Project: Mesos
>          Issue Type: Bug
>          Components: build
>            Reporter: QuellaZhang
>            Priority: Major
>              Labels: windows
>
> Hi All,
> We've stumbled across some build failures in Mesos after implementing support 
> for char8_t under /std:c + + +latest  in the development version of Visual C+ 
> + +. Could you help look at this? Thanks in advance! Noted that this issue 
> only found when compiles with unreleased vctoolset, that next release of MSVC 
> will have this behavior.
> *Repro steps:*
>  git clone -c core.autocrlf=true [https://github.com/apache/mesos] 
> D:\mesos\src
>  open a VS 2017 x64 command prompt as admin and browse to D:\mesos
>  set _CL_=/std:c++latest
>  cd src
>  .\bootstrap.bat
>  cd ..
>  mkdir build_x64 && pushd build_x64
>  cmake ..\src -G "Visual Studio 15 2017 Win64" 
> -DCMAKE_SYSTEM_VERSION=10.0.17134.0 -DENABLE_LIBEVENT=1 
> -DHAS_AUTHENTICATION=0 -DPATCHEXE_PATH="C:\gnuwin32\bin" -T host=x64
> *Failures:*
>  base64_tests.i
>  D:\Mesos\src\3rdparty\stout\tests\base64_tests.cpp(63): error C2664: 
> 'std::string base64::encode_url_safe(const std::string &,bool)': cannot 
> convert argument 1 from 'const char8_t [12]' to 'const std::string &'
>  D:\Mesos\src\3rdparty\stout\tests\base64_tests.cpp(63): note: Reason: cannot 
> convert from 'const char8_t [12]' to 'const std::string'
>  D:\Mesos\src\3rdparty\stout\tests\base64_tests.cpp(63): note: No constructor 
> could take the source type, or constructor overload resolution was ambiguous
>  D:\Mesos\src\3rdparty\stout\tests\base64_tests.cpp(63): error C2660: 
> 'testing::internal::EqHelper<false>::Compare': function does not take 3 
> arguments
>  
> D:\Mesos\build_x64\3rdparty\googletest-1.8.0\src\googletest-1.8.0\googletest\include\gtest/gtest.h(1430):
>  note: see declaration of 'testing::internal::EqHelper<false>::Compare'
>  D:\Mesos\src\3rdparty\stout\tests\base64_tests.cpp(63): error C2512: 
> 'testing::AssertionResult': no appropriate default constructor available
>  
> D:\Mesos\build_x64\3rdparty\googletest-1.8.0\src\googletest-1.8.0\googletest\include\gtest/gtest.h(256):
>  note: see declaration of 'testing::AssertionResult'
>  D:\Mesos\src\3rdparty\stout\tests\base64_tests.cpp(67): error C2664: 
> 'std::string base64::encode_url_safe(const std::string &,bool)': cannot 
> convert argument 1 from 'const char8_t [12]' to 'const std::string &'
>  D:\Mesos\src\3rdparty\stout\tests\base64_tests.cpp(67): note: Reason: cannot 
> convert from 'const char8_t [12]' to 'const std::string'
>  D:\Mesos\src\3rdparty\stout\tests\base64_tests.cpp(67): note: No constructor 
> could take the source type, or constructor overload resolution was ambiguous
>  D:\Mesos\src\3rdparty\stout\tests\base64_tests.cpp(67): error C2660: 
> 'testing::internal::EqHelper<false>::Compare': function does not take 3 
> arguments
>  
> D:\Mesos\build_x64\3rdparty\googletest-1.8.0\src\googletest-1.8.0\googletest\include\gtest/gtest.h(1430):
>  note: see declaration of 'testing::internal::EqHelper<false>::Compare'
>  D:\Mesos\src\3rdparty\stout\tests\base64_tests.cpp(67): error C2512: 
> 'testing::AssertionResult': no appropriate default constructor available
>  
> D:\Mesos\build_x64\3rdparty\googletest-1.8.0\src\googletest-1.8.0\googletest\include\gtest/gtest.h(256):
>  note: see declaration of 'testing::AssertionResult'
>  D:\Mesos\src\3rdparty\stout\tests\base64_tests.cpp(83): error C2664: 
> 'Try<std::string,Error> base64::decode_url_safe(const std::string &)': cannot 
> convert argument 1 from 'const char8_t [16]' to 'const std::string &'
>  D:\Mesos\src\3rdparty\stout\tests\base64_tests.cpp(83): note: Reason: cannot 
> convert from 'const char8_t [16]' to 'const std::string'
>  D:\Mesos\src\3rdparty\stout\tests\base64_tests.cpp(83): note: No constructor 
> could take the source type, or constructor overload resolution was ambiguous
>  D:\Mesos\src\3rdparty\stout\tests\base64_tests.cpp(83): error C2672: 
> 'AssertSomeEq': no matching overloaded function found
>  D:\Mesos\src\3rdparty\stout\tests\base64_tests.cpp(83): error C2780: 
> 'testing::AssertionResult AssertSomeEq(const char *,const char *,const T1 
> &,const T2 &)': expects 4 arguments - 3 provided
>  D:\Mesos\src\3rdparty\stout\include\stout/gtest.hpp(79): note: see 
> declaration of 'AssertSomeEq'
>  D:\Mesos\src\3rdparty\stout\tests\base64_tests.cpp(83): error C2512: 
> 'testing::AssertionResult': no appropriate default constructor available
>  
> D:\Mesos\build_x64\3rdparty\googletest-1.8.0\src\googletest-1.8.0\googletest\include\gtest/gtest.h(256):
>  note: see declaration of 'testing::AssertionResult'
>  D:\Mesos\src\3rdparty\stout\tests\base64_tests.cpp(87): error C2664: 
> 'Try<std::string,Error> base64::decode_url_safe(const std::string &)': cannot 
> convert argument 1 from 'const char8_t [17]' to 'const std::string &'
>  D:\Mesos\src\3rdparty\stout\tests\base64_tests.cpp(87): note: Reason: cannot 
> convert from 'const char8_t [17]' to 'const std::string'
>  D:\Mesos\src\3rdparty\stout\tests\base64_tests.cpp(87): note: No constructor 
> could take the source type, or constructor overload resolution was ambiguous
>  D:\Mesos\src\3rdparty\stout\tests\base64_tests.cpp(87): error C2672: 
> 'AssertSomeEq': no matching overloaded function found
>  D:\Mesos\src\3rdparty\stout\tests\base64_tests.cpp(87): error C2780: 
> 'testing::AssertionResult AssertSomeEq(const char *,const char *,const T1 
> &,const T2 &)': expects 4 arguments - 3 provided
>  D:\Mesos\src\3rdparty\stout\include\stout/gtest.hpp(79): note: see 
> declaration of 'AssertSomeEq'
>  D:\Mesos\src\3rdparty\stout\tests\base64_tests.cpp(87): error C2512: 
> 'testing::AssertionResult': no appropriate default constructor available
>  
> D:\Mesos\build_x64\3rdparty\googletest-1.8.0\src\googletest-1.8.0\googletest\include\gtest/gtest.h(256):
>  note: see declaration of 'testing::AssertionResult'
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to