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

Bug with C++20 or newer in Visual Studio #1545

Open
OgreTransporter opened this issue Oct 17, 2024 · 1 comment
Open

Bug with C++20 or newer in Visual Studio #1545

OgreTransporter opened this issue Oct 17, 2024 · 1 comment

Comments

@OgreTransporter
Copy link

I have loaded the current release (https://archives.boost.io/release/1.86.0/source/boost_1_86_0.7z) and created the following test project:

CMakeLists.txt

cmake_minimum_required(VERSION 3.25)
project(ASIO-Test)

set(CXX_STANDARD_REQUIRED ON)
set(Boost_USE_MULTITHREADED ON)
if(WIN32)
    set(Boost_USE_STATIC_LIBS ON)
endif()
find_package(Boost REQUIRED)

add_definitions(-D_WIN32_WINNT=0x0601)

add_executable(Test14 main.cpp)
target_include_directories(Test14 PRIVATE ${Boost_INCLUDE_DIR})
target_link_libraries(Test14 PRIVATE Boost::headers)
target_compile_options(Test14 PRIVATE "/std:c++14")

add_executable(Test17 main.cpp)
target_include_directories(Test17 PRIVATE ${Boost_INCLUDE_DIR})
target_link_libraries(Test17 PRIVATE Boost::headers)
target_compile_options(Test17 PRIVATE "/std:c++17")

add_executable(Test20 main.cpp)
target_include_directories(Test20 PRIVATE ${Boost_INCLUDE_DIR})
target_link_libraries(Test20 PRIVATE Boost::headers)
target_compile_options(Test20 PRIVATE "/std:c++20")

add_executable(TestLatest main.cpp)
target_include_directories(TestLatest PRIVATE ${Boost_INCLUDE_DIR})
target_link_libraries(TestLatest PRIVATE Boost::headers)
target_compile_options(TestLatest PRIVATE "/std:c++latest")

main.cpp

#include <boost/asio.hpp>

int main(int argc, char* argv[])
{
	return 0;
}

If the C++ standard is set to C++20 or newer, there are errors when compiling. It is sufficient to include the ASIO header. It is not necessary to use ASIO.

1>------ Build started: Project: ZERO_CHECK, Configuration: Debug x64 ------
1>1>Checking Build System
2>------ Build started: Project: TestLatest, Configuration: Debug x64 ------
3>------ Build started: Project: Test20, Configuration: Debug x64 ------
4>------ Build started: Project: Test17, Configuration: Debug x64 ------
5>------ Build started: Project: Test14, Configuration: Debug x64 ------
2>Building Custom Rule D:/boost/CMakeLists.txt
3>Building Custom Rule D:/boost/CMakeLists.txt
2>main.cpp
4>Building Custom Rule D:/boost/CMakeLists.txt
3>main.cpp
5>Building Custom Rule D:/boost/CMakeLists.txt
4>main.cpp
5>main.cpp
2>D:\boost\boost_1_86_0\boost/asio/co_composed.hpp(162,33): error C3546: '...': there are no parameter packs available to expand
2>D:\boost\boost_1_86_0\boost/asio/co_composed.hpp(163,2): message : see reference to class template instantiation 'boost::asio::detail::co_composed_state_return<Executors,Handler,boost::asio::detail::co_composed_returns<Signatures...>>' being compiled
3>D:\boost\boost_1_86_0\boost/asio/co_composed.hpp(162,33): error C3546: '...': there are no parameter packs available to expand
3>D:\boost\boost_1_86_0\boost/asio/co_composed.hpp(163,2): message : see reference to class template instantiation 'boost::asio::detail::co_composed_state_return<Executors,Handler,boost::asio::detail::co_composed_returns<Signatures...>>' being compiled
4>Test17.vcxproj -> D:\boost\build\Debug\Test17.exe
5>Test14.vcxproj -> D:\boost\build\Debug\Test14.exe
2>Done building project "TestLatest.vcxproj" -- FAILED.
3>Done building project "Test20.vcxproj" -- FAILED.
6>------ Skipped Build: Project: ALL_BUILD, Configuration: Debug x64 ------
6>Project not selected to build for this solution configuration 
========== Build: 3 succeeded, 2 failed, 0 up-to-date, 1 skipped ==========
  • Operating system: Windows 10
  • Visual Studio: Microsoft Visual Studio 2022 (17.11.5)
  • Compiler: MSVC 19.36.32546 (x64)
@Tofficus
Copy link

Tofficus commented Oct 28, 2024

I confirm that there is a problem in my project.
Windows 10
Microsoft Visual Studio Enterprise 2022 (64-bit) - Current Version 17.6.0
17.6.33712.159
ISO C++20 Standard (/std:c++20)

I get an error on Asio versions 1-31 and 1-32

1>init.cpp
1>c:\dev\asio-asio-1-31-0\asio\include\asio\co_composed.hpp(161,33): error C3546: '...': there are no parameter packs available to expand
1>c:\dev\asio-asio-1-31-0\asio\include\asio\co_composed.hpp(162,2): message : see reference to class template instantiation 'asio::detail::co_composed_state_return<Executors,Handler,asio::detail::co_composed_returns<Signatures...>>' being compiled
1>main.cpp
1>TCPClient.cpp
1>c:\dev\asio-asio-1-31-0\asio\include\asio\co_composed.hpp(161,33): error C3546: '...': there are no parameter packs available to expand
1>c:\dev\asio-asio-1-31-0\asio\include\asio\co_composed.hpp(162,2): message : see reference to class template instantiation 'asio::detail::co_composed_state_return<Executors,Handler,asio::detail::co_composed_returns<Signatures...>>' being compiled
1>TCPConnection.cpp
1>c:\dev\asio-asio-1-31-0\asio\include\asio\co_composed.hpp(161,33): error C3546: '...': there are no parameter packs available to expand
1>c:\dev\asio-asio-1-31-0\asio\include\asio\co_composed.hpp(162,2): message : see reference to class template instantiation 'asio::detail::co_composed_state_return<Executors,Handler,asio::detail::co_composed_returns<Signatures...>>' being compiled
1>UDPFormularServer.cpp
1>c:\dev\asio-asio-1-31-0\asio\include\asio\co_composed.hpp(161,33): error C3546: '...': there are no parameter packs available to expand
1>c:\dev\asio-asio-1-31-0\asio\include\asio\co_composed.hpp(162,2): message : see reference to class template instantiation 'asio::detail::co_composed_state_return<Executors,Handler,asio::detail::co_composed_returns<Signatures...>>' being compiled

1>init.cpp
1>c:\dev\asio-asio-1-32-0\asio\include\asio\co_composed.hpp(161,33): error C3546: '...': there are no parameter packs available to expand
1>c:\dev\asio-asio-1-32-0\asio\include\asio\co_composed.hpp(162,2): message : see reference to class template instantiation 'asio::detail::co_composed_state_return<Executors,Handler,asio::detail::co_composed_returns<Signatures...>>' being compiled
1>main.cpp
1>TCPClient.cpp
1>c:\dev\asio-asio-1-32-0\asio\include\asio\co_composed.hpp(161,33): error C3546: '...': there are no parameter packs available to expand
1>c:\dev\asio-asio-1-32-0\asio\include\asio\co_composed.hpp(162,2): message : see reference to class template instantiation 'asio::detail::co_composed_state_return<Executors,Handler,asio::detail::co_composed_returns<Signatures...>>' being compiled
1>TCPConnection.cpp
1>c:\dev\asio-asio-1-32-0\asio\include\asio\co_composed.hpp(161,33): error C3546: '...': there are no parameter packs available to expand
1>c:\dev\asio-asio-1-32-0\asio\include\asio\co_composed.hpp(162,2): message : see reference to class template instantiation 'asio::detail::co_composed_state_return<Executors,Handler,asio::detail::co_composed_returns<Signatures...>>' being compiled
1>UDPFormularServer.cpp
1>c:\dev\asio-asio-1-32-0\asio\include\asio\co_composed.hpp(161,33): error C3546: '...': there are no parameter packs available to expand
1>c:\dev\asio-asio-1-32-0\asio\include\asio\co_composed.hpp(162,2): message : see reference to class template instantiation 'asio::detail::co_composed_state_return<Executors,Handler,asio::detail::co_composed_returns<Signatures...>>' being compiled

There is no error on version 1-28

Add:

and no problem on Microsoft Visual Studio (64-bit) Version 17.11.5
VisualStudio.17.Release/17.11.5+35327.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants