Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<execution>: Including with /clr enabled results in compiler error. #955

Closed
AlexGuteniev opened this issue Jul 1, 2020 · 2 comments · Fixed by #3194
Closed

<execution>: Including with /clr enabled results in compiler error. #955

AlexGuteniev opened this issue Jul 1, 2020 · 2 comments · Fixed by #3194
Labels
bug Something isn't working fixed Something works now, yay!

Comments

@AlexGuteniev
Copy link
Contributor

AlexGuteniev commented Jul 1, 2020

Describe the bug
Including <execution> and compiling with /clr emits a lot of compiler errors.

Command-line test case

d:\Temp2>type repro.cpp
#include <execution>

int main() {}

d:\Temp2>cl /clr /std:c++17 repro.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.27.29009.1
for Microsoft (R) .NET Framework version 4.08.4084.0
Copyright (C) Microsoft Corporation.  All rights reserved.

repro.cpp
c:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.27.29009\include\execution(401): error C3646: '_Mtx': unknown override specifier
c:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.27.29009\include\execution(428): note: see reference to class template instantiation 'std::_Parallel_choose_min_chunk<_Ty>' being compiled
c:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.27.29009\include\execution(401): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.27.29009\include\execution(436): error C3646: '_Mtx': unknown override specifier
c:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.27.29009\include\execution(463): note: see reference to class template instantiation 'std::_Parallel_choose_max_chunk<_Ty>' being compiled
c:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.27.29009\include\execution(436): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.27.29009\include\execution(647): error C3646: '_Segment_lock': unknown override specifier
c:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.27.29009\include\execution(648): note: see reference to class template instantiation 'std::_Work_stealing_deque<_Ty>' being compiled
c:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.27.29009\include\execution(647): error C2059: syntax error: '{'
c:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.27.29009\include\execution(647): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
c:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.27.29009\include\execution(749): error C3646: '_Available_mutex': unknown override specifier
c:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.27.29009\include\execution(751): note: see reference to class template instantiation 'std::_Work_stealing_team<_Ty>' being compiled
c:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.27.29009\include\execution(749): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

Expected behavior
Either program compiles, or a short error message is emitted.
Depending on whether it is expected to compile,
(Generic issue for this question is #838 , but a specific answer should be enough)

STL version

Microsoft Visual Studio Professional 2019 Preview
Version 16.7.0 Preview 3.1

Additional context
This item is also tracked on Developer Community as DevCom-642475 and by Microsoft-internal VSO-947547 / AB#947547.

@CaseyCarter CaseyCarter added the bug Something isn't working label Jul 1, 2020
@StephanTLavavej
Copy link
Member

What's happening is that <mutex> isn't completely blocked under /clr, it just declines to provide std::mutex etc. Then <execution> unconditionally needs std::mutex.

@CaseyCarter
Copy link
Contributor

CaseyCarter commented Jul 5, 2020

Then <execution> unconditionally needs std::mutex.

Which is peculiar, because there's some conditional compilation near the top of <execution>:

STL/stl/inc/execution

Lines 37 to 45 in 5be7d49

#ifdef _M_CEE
using __std_TP_WORK = void;
using __std_TP_CALLBACK_INSTANCE = void;
using __std_TP_CALLBACK_ENVIRON = void;
#else // ^^^ _M_CEE ^^^ // vvv !_M_CEE vvv
struct __std_TP_WORK; // not defined
struct __std_TP_CALLBACK_INSTANCE; // not defined
struct __std_TP_CALLBACK_ENVIRON; // not defined
#endif // _M_CEE

that suggests this header is intended to tolerate /clr. We need to make up our mind ;)

@StephanTLavavej StephanTLavavej added the fixed Something works now, yay! label Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed Something works now, yay!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants