You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@mesos.apache.org by "Benjamin Bannier (Jira)" <ji...@apache.org> on 2019/11/04 09:53:00 UTC

[jira] [Commented] (MESOS-10028) Mesos failed to build due to error C3493 on windows with MSVC

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

Benjamin Bannier commented on MESOS-10028:
------------------------------------------

This issue is due to disagreement between GCC & Clang, and MSVC around this piece of code:
{code}
  const size_t childRoleLength = 36u;
  vector<string> roles(param.roleCount);
  std::generate(roles.begin(), roles.end(), [&randString]() {
    return "role-" + randString(childRoleLength);
  });
{code}

I believe {{childRoleLength}} is ODR-used here since it is {{const}} and initialized by a constant expression. With that, I believe it should be implicitly captured, http://eel.is/c++draft/expr.prim.lambda.capture#7.3, but MSVC seems to disagree.

We could work around this by either capturing {{childRoleLength}} by value and marking the lambda with some {{NOLINT}}, or maybe simpler, remove the {{const}} qualifier from {{childRoleLength}}.

Could you look into this [~mzhu]?

> Mesos failed to build due to error C3493 on windows with MSVC
> -------------------------------------------------------------
>
>                 Key: MESOS-10028
>                 URL: https://issues.apache.org/jira/browse/MESOS-10028
>             Project: Mesos
>          Issue Type: Bug
>          Components: build
>    Affects Versions: master
>         Environment: VS 2017 + Windows Server 2016
>            Reporter: LinGao
>            Priority: Major
>         Attachments: log_x64_build.log
>
>
> Mesos failed to build due to error C3493: 'childRoleLength' cannot be implicitly captured because no default capture mode has been specified on Windows using MSVC. It can be first reproduced on 69e92ae reversion on master branch. Could you please take a look at this isssue? Thanks a lot!
>  
> Reproduce steps:
> 1. git clone -c core.autocrlf=true https://github.com/apache/mesos D:\mesos\src
> 2. Open a VS 2017 x64 command prompt as admin and browse to D:\mesos
> 3. cd src
> 4. .\bootstrap.bat
> 5. cd ..
> 6. mkdir build_x64 && pushd build_x64
> 7. 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
> 8. msbuild Mesos.sln /p:Configuration=Debug /p:Platform=x64 /maxcpucount:4 /t:Rebuild
>  
> ErrorMessage:
> D:\mesos\src\src\tests\hierarchical_allocator_tests.cpp(8455): error C3493: 'childRoleLength' cannot be implicitly captured because no default capture mode has been specified



--
This message was sent by Atlassian Jira
(v8.3.4#803005)