-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed
Description
Description
CoreCLR failed to build with MSVC due to error C2280 and error C2088 with option /std:c++20, detailed error message as follows:
F:\gitP\dotnet\runtime\src\native\corehost\test\nativehost\comhost_test.cpp(64): error C2280: 'std::basic_ostream<char,std::char_traits<char>> &std::operator <<<std::char_traits<char>>(std::basic_ostream<char,std::char_traits<char>> &,const wchar_t *)': attempting to reference a deleted function
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\include\ostream(971): note: see declaration of 'std::operator <<'
F:\gitP\dotnet\runtime\src\native\corehost\test\nativehost\comhost_test.cpp(64): error C2088: '<<': illegal for class
Reproduction Steps
- git clone https://github.com/dotnet/runtime F:\gitP\dotnet\runtime
- git -C "F:\gitP\dotnet\runtime" reset --hard b90c9cf
- set CL=/std:c++latest /permissive /wd5054 /wd5055 /wd5033 /D_HAS_STD_BYTE=0 /Zc:equalityRewrite-
- cd F:\gitP\dotnet\runtime
- .\build.cmd -subset clr+libs -c release -arch x64
Expected behavior
Build successfully.
Actual behavior
F:\gitP\dotnet\runtime\src\native\corehost\test\nativehost\hostpolicy_exports.cpp(11): error C2280: 'std::basic_ostream<char,std::char_traits<char>> &std::operator <<<std::char_traits<char>>(std::basic_ostream<char,std::char_traits<char>> &,const wchar_t *)': attempting to reference a deleted function
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\include\ostream(971): note: see declaration of 'std::operator <<'
F:\gitP\dotnet\runtime\src\native\corehost\test\nativehost\hostpolicy_exports.cpp(11): error C2088: '<<': illegal for class
F:\gitP\dotnet\runtime\src\native\corehost\test\nativehost\comhost_test.cpp(64): error C2280: 'std::basic_ostream<char,std::char_traits<char>> &std::operator <<<std::char_traits<char>>(std::basic_ostream<char,std::char_traits<char>> &,const wchar_t *)': attempting to reference a deleted function
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\include\ostream(971): note: see declaration of 'std::operator <<'
F:\gitP\dotnet\runtime\src\native\corehost\test\nativehost\comhost_test.cpp(64): error C2088: '<<': illegal for class
Regression?
No response
Known Workarounds
add option /D_HAS_STREAM_INSERTION_OPERATORS_DELETED_IN_CXX20,the error will disappear.
Configuration
OS: Windows Server 2022
VS: VS2022 17.5.4
.NET 8.0
Other information
No response
Reactions are currently unavailable