Boost Asio: ‘…’: there are no parameter packs available to expand

I’m trying to use boost asio to send some udp packets, but I am getting:

[main] Building folder: C:/Users/tom.mclean/src/Nemo/build nemo
[build] Starting build
[proc] Executing command: C:Userstom.mcleanAppDataLocalminiconda3Scriptscmake.EXE --build C:/Users/tom.mclean/src/Nemo/build --parallel 18 --target nemo --
[build] [0/2] Re-checking globbed directories...
[build] [1/3] Building CXX object CMakeFilesnemo.dirnemonemo.cpp.obj
[build] FAILED: CMakeFiles/nemo.dir/nemo/nemo.cpp.obj 
[build] C:PROGRA~1MIB055~12022COMMUN~1VCToolsMSVC1436~1.325binHostx86x86cl.exe  /nologo /TP -DBOOST_CONTAINER_DYN_LINK -DBOOST_CONTAINER_NO_LIB -DBOOST_CONTEXT_DYN_LINK="" -DBOOST_CONTEXT_EXPORT=EXPORT -DBOOST_CONTEXT_NO_LIB="" -DBOOST_COROUTINES_DYN_LINK -DBOOST_COROUTINE_DYN_LINK -DBOOST_COROUTINE_NO_LIB -DBOOST_DATE_TIME_DYN_LINK -DBOOST_DATE_TIME_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK=1 -DBOOST_FILESYSTEM_NO_LIB -DBOOST_UUID_FORCE_AUTO_LINK -DEZXML_NOMMAP -DFMI4C_STATIC -DHAVE_MEMMOVE=1 -DUSE_FILE32API -IC:Userstom.mcleansrcNemoexternalODSClientinclude -IC:Userstom.mcleansrcNemoexternalfmi4cinclude -IC:Userstom.mcleansrcNemoexternalfmi4c3rdparty -IC:Userstom.mcleansrcNemoexternalfmi4c3rdpartyminizip -external:IC:Userstom.mcleansrcNemo -external:IC:Userstom.mcleansrcvcpkg_installedx86-windowsinclude -external:IC:Userstom.mcleansrcvcpkg_installedx86-windowsincludeeigen3 -external:IC:Userstom.mcleansrcvcpkg_installedx86-windowsincludeSDL2 -external:W0 /DWIN32 /D_WINDOWS /GR /EHsc /O2 /Ob2 /DNDEBUG -std:c++20 -MD /bigobj /showIncludes /FoCMakeFilesnemo.dirnemonemo.cpp.obj /FdCMakeFilesnemo.dirnemo.pdb /FS -c C:Userstom.mcleansrcNemonemonemo.cpp
[build] Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. For example:
[build] - add -D_WIN32_WINNT=0x0601 to the compiler command line; or
[build] - add _WIN32_WINNT=0x0601 to your project's Preprocessor Definitions.
[build] Assuming _WIN32_WINNT=0x0601 (i.e. Windows 7 target).
[build] C:Userstom.mcleansrcvcpkg_installedx86-windowsincludeboost/asio/co_composed.hpp(162): error C3546: '...': there are no parameter packs available to expand
[build] C:Userstom.mcleansrcvcpkg_installedx86-windowsincludeboost/asio/co_composed.hpp(163): note: see reference to class template instantiation 'boost::asio::detail::co_composed_state_return<Executors,Handler,boost::asio::detail::co_composed_returns<Signatures...>>' being compiled
[build] ninja: build stopped: subcommand failed.
[proc] The command: C:Userstom.mcleanAppDataLocalminiconda3Scriptscmake.EXE --build C:/Users/tom.mclean/src/Nemo/build --parallel 18 --target nemo -- exited with code: 1
[driver] Build completed: 00:00:08.065
[build] Build finished with exit code 1

My minimal example is:

#include <boost/asio.hpp>
#include <iostream>

int main() {
    try {
        boost::asio::io_context io_context;
        boost::asio::ip::udp::endpoint server_endpoint(boost::asio::ip::make_address("127.0.0.1"), 12345);
        boost::asio::ip::udp::socket socket(io_context);
        socket.open(boost::asio::ip::udp::v4());
        const std::string message = "Hello, UDP Server!";
        socket.send_to(boost::asio::buffer(message), server_endpoint);
        std::cout << "Message sent to server: " << message << std::endl;

    } catch (const std::exception& e) {
        std::cerr << "Error: " << e.what() << std::endl;
    }

    return 0;
}

And my CMakeLists.txt is:

cmake_minimum_required(VERSION 3.18)
set(BOOST_ALL_STATIC_LIB ON)
include(${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake)

project(test VERSION 1.0.0 LANGUAGES CXX)
find_package(boost_asio CONFIG REQUIRED)

add_executable(main main.cpp)
target_link_libraries(main PRIVATE Boost::asio)
target_compile_features(main PUBLIC cxx_std_20)

The error seems to come from target_compile_features(main PUBLIC cxx_std_20). If I set it to target_compile_features(main PUBLIC cxx_std_17) it compiles fine. I thought C++ was backwards compatible, so why does this break?

Github repo of error: https://github.com/mcleantom/so-79276056

18

Kudos for the excellent self-contained example in the Github repo.

So, I dusted off my Windows installation, installed VS2022, CMake, vcpkg, Ninja and Github Desktop to reproduce this.

It turns out it doesn’t reproduce for me. This is both before and after I applied the updates to 17.12.3

Microsoft Visual Studio Community 2022
Version 17.12.3
VisualStudio.17.Release/17.12.3+35527.113
Installed Version: Community
Visual C++ 2022   00482-90000-00000-AA007
Microsoft Visual C++ 2022

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật