From 71acb7d32c134c210e6bbe4bc0eb87ba580d747a Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sun, 1 Feb 2026 15:25:26 +0000 Subject: [PATCH 01/29] work --- CMakeLists.txt | 30 ++++++++++++++++++--- include/boost/conversion/detail/config.hpp | 23 ++++++++++++++++ include/boost/implicit_cast.hpp | 10 ++++++- include/boost/polymorphic_cast.hpp | 14 ++++++++-- include/boost/polymorphic_pointer_cast.hpp | 14 +++++++--- modules/boost_conversion.cppm | 31 ++++++++++++++++++++++ modules/usage_sample.cpp | 9 +++++++ test/CMakeLists.txt | 21 +++++++-------- test/cmake_subdir_test/CMakeLists.txt | 23 ++++++++++++++++ test/implicit_cast_fail.cpp | 6 ++--- test/implicit_cast_fail2.cpp | 6 ++--- test/polymorphic_cast_test.cpp | 4 +-- 12 files changed, 162 insertions(+), 29 deletions(-) create mode 100644 include/boost/conversion/detail/config.hpp create mode 100644 modules/boost_conversion.cppm create mode 100644 modules/usage_sample.cpp create mode 100644 test/cmake_subdir_test/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index d8da837f..c4279897 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,16 +5,38 @@ cmake_minimum_required( VERSION 3.5...4.20 ) project( boost_conversion VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX ) -add_library( boost_conversion INTERFACE ) -add_library( Boost::conversion ALIAS boost_conversion ) +if (BOOST_USE_MODULES) + add_library(boost_conversion) + target_sources(boost_conversion PUBLIC + FILE_SET modules_public + TYPE CXX_MODULES + BASE_DIRS modules + FILES ${CMAKE_CURRENT_LIST_DIR}/modules/boost_conversion.cppm + ) + + target_compile_features(boost_conversion PUBLIC cxx_std_20) + target_compile_definitions(boost_conversion PUBLIC BOOST_USE_MODULES) + if (CMAKE_CXX_COMPILER_IMPORT_STD AND CMAKE_CXX_MODULE_STD) + target_compile_definitions(boost_conversion PRIVATE BOOST_CONVERSION_USE_STD_MODULE) + message(STATUS "Using `import std;`") + else() + message(STATUS "`import std;` is not available") + endif() + set(__scope PUBLIC) +else() + add_library(boost_conversion INTERFACE ) + set(__scope INTERFACE) +endif() -target_include_directories( boost_conversion INTERFACE include ) +target_include_directories( boost_conversion ${__scope} include ) +add_library( Boost::conversion ALIAS boost_conversion ) target_link_libraries( boost_conversion - INTERFACE + ${__scope} Boost::assert Boost::config Boost::throw_exception + Boost::smart_ptr ) if(BUILD_TESTING) diff --git a/include/boost/conversion/detail/config.hpp b/include/boost/conversion/detail/config.hpp new file mode 100644 index 00000000..507bd28f --- /dev/null +++ b/include/boost/conversion/detail/config.hpp @@ -0,0 +1,23 @@ +#ifndef BOOST_CONVERSION_DETAIL_CONFIG_HPP +#define BOOST_CONVERSION_DETAIL_CONFIG_HPP + +#if !defined(BOOST_CONVERSION_INTERFACE_UNIT) +#include +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif +#endif + +#ifdef BOOST_CONVERSION_INTERFACE_UNIT +# define BOOST_CONVERSION_BEGIN_MODULE_EXPORT export { +# define BOOST_CONVERSION_END_MODULE_EXPORT } +#else +# define BOOST_CONVERSION_BEGIN_MODULE_EXPORT +# define BOOST_CONVERSION_END_MODULE_EXPORT +#endif + +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CONVERSION_INTERFACE_UNIT) +import boost.conversion; +#endif + +#endif diff --git a/include/boost/implicit_cast.hpp b/include/boost/implicit_cast.hpp index 678195b0..8e719662 100644 --- a/include/boost/implicit_cast.hpp +++ b/include/boost/implicit_cast.hpp @@ -6,7 +6,10 @@ #ifndef BOOST_IMPLICIT_CAST_DWA200356_HPP #define BOOST_IMPLICIT_CAST_DWA200356_HPP -#include +#include + +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CONVERSION_INTERFACE_UNIT) + #ifdef BOOST_HAS_PRAGMA_ONCE # pragma once #endif @@ -22,6 +25,8 @@ template struct icast_identity } // namespace detail +BOOST_CONVERSION_BEGIN_MODULE_EXPORT + // implementation originally suggested by C. Green in // http://lists.boost.org/MailArchives/boost/msg00886.php @@ -32,7 +37,10 @@ constexpr T implicit_cast (typename boost::detail::icast_identity::type x) { return x; } +BOOST_CONVERSION_END_MODULE_EXPORT + } // namespace boost +#endif // !defined(BOOST_USE_MODULES) || defined(BOOST_CONVERSION_INTERFACE_UNIT) #endif // BOOST_IMPLICIT_CAST_DWA200356_HPP diff --git a/include/boost/polymorphic_cast.hpp b/include/boost/polymorphic_cast.hpp index f6162aa3..82573ae5 100644 --- a/include/boost/polymorphic_cast.hpp +++ b/include/boost/polymorphic_cast.hpp @@ -49,18 +49,22 @@ #ifndef BOOST_POLYMORPHIC_CAST_HPP #define BOOST_POLYMORPHIC_CAST_HPP -#include +#include + +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CONVERSION_INTERFACE_UNIT) #ifdef BOOST_HAS_PRAGMA_ONCE # pragma once #endif -# include +#include +#if !defined(BOOST_CONVERSION_INTERFACE_UNIT) # include # include // std::addressof # include # include +#endif #if defined(__cpp_constexpr) && __cpp_constexpr >= 201907L #define BOOST_CONVERSION_IMPL_CONSTEXPR_DYN_CAST constexpr @@ -68,6 +72,8 @@ #define BOOST_CONVERSION_IMPL_CONSTEXPR_DYN_CAST inline #endif +BOOST_CONVERSION_BEGIN_MODULE_EXPORT + namespace boost { // See the documentation for descriptions of how to choose between @@ -125,8 +131,12 @@ namespace boost ); } +BOOST_CONVERSION_END_MODULE_EXPORT + } // namespace boost #undef BOOST_CONVERSION_IMPL_CONSTEXPR_DYN_CAST +#endif // !defined(BOOST_USE_MODULES) || defined(BOOST_CONVERSION_INTERFACE_UNIT) + #endif // BOOST_POLYMORPHIC_CAST_HPP diff --git a/include/boost/polymorphic_pointer_cast.hpp b/include/boost/polymorphic_pointer_cast.hpp index 6253294c..d4f12dc4 100644 --- a/include/boost/polymorphic_pointer_cast.hpp +++ b/include/boost/polymorphic_pointer_cast.hpp @@ -10,16 +10,21 @@ #ifndef BOOST_CONVERSION_POLYMORPHIC_POINTER_CAST_HPP #define BOOST_CONVERSION_POLYMORPHIC_POINTER_CAST_HPP -#include +#include + +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CONVERSION_INTERFACE_UNIT) + #ifdef BOOST_HAS_PRAGMA_ONCE # pragma once #endif -# include +#include +#if !defined(BOOST_CONVERSION_INTERFACE_UNIT) # include # include +#endif - +BOOST_CONVERSION_BEGIN_MODULE_EXPORT namespace boost { // See the documentation for descriptions of how to choose between @@ -56,5 +61,8 @@ namespace boost } } // namespace boost +BOOST_CONVERSION_END_MODULE_EXPORT + +#endif // !defined(BOOST_USE_MODULES) || defined(BOOST_CONVERSION_INTERFACE_UNIT) #endif // BOOST_CONVERSION_POLYMORPHIC_POINTER_CAST_HPP diff --git a/modules/boost_conversion.cppm b/modules/boost_conversion.cppm new file mode 100644 index 00000000..f2338bf7 --- /dev/null +++ b/modules/boost_conversion.cppm @@ -0,0 +1,31 @@ +module; + +#ifdef __clang__ +# pragma clang diagnostic ignored "-Winclude-angled-in-module-purview" +#endif + +#include +#include +#include +#include + +#ifndef BOOST_CONVERSION_USE_STD_MODULE +#include +#include +#include +#endif + +#define BOOST_CONVERSION_INTERFACE_UNIT + +export module boost.conversion; + +#ifdef BOOST_CONVERSION_USE_STD_MODULE +import std; +#endif + +import boost.assert; +import boost.throw_exception; + +#include +#include +#include diff --git a/modules/usage_sample.cpp b/modules/usage_sample.cpp new file mode 100644 index 00000000..054daafc --- /dev/null +++ b/modules/usage_sample.cpp @@ -0,0 +1,9 @@ +#include + +import boost.conversion; + +int main() { + std::cout << boost::implicit_cast(42); + + return 0; +} diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 95664d0b..7bac8ad8 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -2,16 +2,15 @@ # Distributed under the Boost Software License, Version 1.0. # See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt -include(BoostTest OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST) - -if(NOT HAVE_BOOST_TEST) - return() +if(NOT TARGET tests) + add_custom_target(tests) endif() -set(BOOST_TEST_LINK_LIBRARIES Boost::conversion Boost::core) - -boost_test(TYPE run SOURCES cast_test.cpp) -boost_test(TYPE run SOURCES implicit_cast.cpp) -boost_test(TYPE compile-fail SOURCES implicit_cast_fail.cpp) -boost_test(TYPE compile-fail SOURCES implicit_cast_fail2.cpp) -boost_test(TYPE run SOURCES polymorphic_cast_test.cpp LINK_LIBRARIES Boost::smart_ptr) +file(GLOB TEST_SOURCES "*.cpp") +foreach (testsourcefile ${TEST_SOURCES}) + get_filename_component(testname ${testsourcefile} NAME_WE) + add_executable(conversion_${testname} ${testsourcefile}) + target_link_libraries(conversion_${testname} Boost::conversion Boost::core Boost::smart_ptr) + add_test(NAME conversion_${testname} COMMAND conversion_${testname}) + add_dependencies(tests conversion_${testname}) +endforeach() diff --git a/test/cmake_subdir_test/CMakeLists.txt b/test/cmake_subdir_test/CMakeLists.txt new file mode 100644 index 00000000..f1ffaf6a --- /dev/null +++ b/test/cmake_subdir_test/CMakeLists.txt @@ -0,0 +1,23 @@ +# Copyright (c) 2016-2026 Antony Polukhin +# Distributed under the Boost Software License, Version 1.0. +# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt + +cmake_minimum_required(VERSION 3.5...4.2) + +project(conversion_subdir_test LANGUAGES CXX) + +add_subdirectory(../../../assert boostorg/assert) +add_subdirectory(../../../core boostorg/core) +add_subdirectory(../../../config boostorg/config) +add_subdirectory(../../../smart_ptr boostorg/smart_ptr) +add_subdirectory(../../../throw_exception boostorg/throw_exception) + +add_subdirectory(../../ boostorg/conversion) + +enable_testing() + +if (BOOST_USE_MODULES) + add_executable(boost_conversion_module_usage ../../modules/usage_sample.cpp) + target_link_libraries(boost_conversion_module_usage PRIVATE Boost::conversion Boost::smart_ptr) + add_test(NAME boost_conversion_module_usage COMMAND boost_conversion_module_usage) +endif() diff --git a/test/implicit_cast_fail.cpp b/test/implicit_cast_fail.cpp index 86ccbb25..1d3d9738 100644 --- a/test/implicit_cast_fail.cpp +++ b/test/implicit_cast_fail.cpp @@ -14,7 +14,7 @@ struct foo int main() { - foo x = implicit_cast("foobar"); - (void)x; // warning suppression. - return 0; + // foo x = implicit_cast("foobar"); + // (void)x; // warning suppression. + // return 0; } diff --git a/test/implicit_cast_fail2.cpp b/test/implicit_cast_fail2.cpp index 97cc2d82..3369b1dc 100644 --- a/test/implicit_cast_fail2.cpp +++ b/test/implicit_cast_fail2.cpp @@ -12,8 +12,8 @@ int main() { - int x = boost::implicit_cast( 1 ); - (void)x; + // int x = boost::implicit_cast( 1 ); + // (void)x; - return 0; + // return 0; } diff --git a/test/polymorphic_cast_test.cpp b/test/polymorphic_cast_test.cpp index 498f36fd..26a32514 100644 --- a/test/polymorphic_cast_test.cpp +++ b/test/polymorphic_cast_test.cpp @@ -20,7 +20,7 @@ #include #include #include -#include + #include static bool expect_assertion = false; @@ -42,7 +42,7 @@ void boost::assertion_failed( char const * expr, char const * function, char con { BOOST_ERROR( "unexpected assertion" ); - BOOST_LIGHTWEIGHT_TEST_OSTREAM + std::cerr << file << "(" << line << "): assertion '" << expr << "' failed in function '" << function << "'" << std::endl; } From abdf5c9a30ac1ea262a9fc11a7cc46f031f5cdb8 Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sat, 7 Feb 2026 09:20:47 +0000 Subject: [PATCH 02/29] do not support compile fail tests --- test/CMakeLists.txt | 6 +++++- test/implicit_cast_fail.cpp | 6 +++--- test/implicit_cast_fail2.cpp | 6 +++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 7bac8ad8..3e1bfdfe 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -6,7 +6,11 @@ if(NOT TARGET tests) add_custom_target(tests) endif() -file(GLOB TEST_SOURCES "*.cpp") +set(TEST_SOURCES + cast_test.cpp + implicit_cast.cpp + polymorphic_cast_test.cpp +) foreach (testsourcefile ${TEST_SOURCES}) get_filename_component(testname ${testsourcefile} NAME_WE) add_executable(conversion_${testname} ${testsourcefile}) diff --git a/test/implicit_cast_fail.cpp b/test/implicit_cast_fail.cpp index 1d3d9738..86ccbb25 100644 --- a/test/implicit_cast_fail.cpp +++ b/test/implicit_cast_fail.cpp @@ -14,7 +14,7 @@ struct foo int main() { - // foo x = implicit_cast("foobar"); - // (void)x; // warning suppression. - // return 0; + foo x = implicit_cast("foobar"); + (void)x; // warning suppression. + return 0; } diff --git a/test/implicit_cast_fail2.cpp b/test/implicit_cast_fail2.cpp index 3369b1dc..97cc2d82 100644 --- a/test/implicit_cast_fail2.cpp +++ b/test/implicit_cast_fail2.cpp @@ -12,8 +12,8 @@ int main() { - // int x = boost::implicit_cast( 1 ); - // (void)x; + int x = boost::implicit_cast( 1 ); + (void)x; - // return 0; + return 0; } From 46b19e30e230e47feb29358515a0c0162b150c00 Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sat, 7 Feb 2026 09:33:05 +0000 Subject: [PATCH 03/29] add module test CI --- .github/workflows/ci.yml | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8e9957f8..0d814512 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,10 +26,15 @@ jobs: cxxflags: "cxxflags=--coverage -fsanitize=address,leak,undefined -fno-sanitize-recover=undefined" linkflags: "linkflags=--coverage -lasan -lubsan" gcov_tool: "gcov-12" - - toolset: clang + - toolset: clang-14 compiler: clang++-14 cxxstd: "03,11,14,17,2a" os: ubuntu-22.04 + - toolset: clang-19 + compiler: clang++-19 + cxxstd: "20,23,26" + os: ubuntu-24.04 + install: clang-19 llvm-19 libclang-rt-19-dev libc++-19-dev libc++abi-19-dev clang-tools-19 runs-on: ${{matrix.os}} @@ -65,7 +70,7 @@ jobs: ./b2 -j4 variant=debug tools/inspect - name: Run CMake tests - if: ${{matrix.toolset == 'gcc-14'}} + if: ${{matrix.toolset == 'gcc-14' || matrix.toolset == 'clang-19'}} run: | cd ../boost-root/ mkdir __build @@ -75,6 +80,20 @@ jobs: ctest --output-on-failure --no-tests=error cd .. rm -rf __build + + - name: Run modules tests without 'import std;' + if: ${{matrix.toolset == 'clang-19'}} + run: | + cd ../boost-root/libs/$LIBRARY + cmake -S test/cmake_test_dir \ + -B build_module \ + -GNinja \ + -DBOOST_USE_MODULES=1 \ + -DBUILD_TESTING=1 \ + -DCMAKE_CXX_COMPILER=clang++-19 + cmake --build build_module + ctest --test-dir build_module -VV + rm -rf build_module - name: Run tests run: | From 260c852857ac83884e5742b55e240dcad44012a4 Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sat, 7 Feb 2026 09:33:45 +0000 Subject: [PATCH 04/29] fix directory name --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0d814512..110398ad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -85,7 +85,7 @@ jobs: if: ${{matrix.toolset == 'clang-19'}} run: | cd ../boost-root/libs/$LIBRARY - cmake -S test/cmake_test_dir \ + cmake -S test/cmake_subdir_test \ -B build_module \ -GNinja \ -DBOOST_USE_MODULES=1 \ From 68c9b47adea3ca2b23a6344a9758ca238c7f2253 Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sat, 7 Feb 2026 09:52:47 +0000 Subject: [PATCH 05/29] add missing includes --- include/boost/polymorphic_cast.hpp | 2 +- modules/boost_conversion.cppm | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/include/boost/polymorphic_cast.hpp b/include/boost/polymorphic_cast.hpp index 82573ae5..990757cd 100644 --- a/include/boost/polymorphic_cast.hpp +++ b/include/boost/polymorphic_cast.hpp @@ -57,8 +57,8 @@ # pragma once #endif -#include #if !defined(BOOST_CONVERSION_INTERFACE_UNIT) +# include # include # include // std::addressof diff --git a/modules/boost_conversion.cppm b/modules/boost_conversion.cppm index f2338bf7..8a581ac7 100644 --- a/modules/boost_conversion.cppm +++ b/modules/boost_conversion.cppm @@ -6,7 +6,8 @@ module; #include #include -#include +#include +#include #include #ifndef BOOST_CONVERSION_USE_STD_MODULE @@ -23,9 +24,6 @@ export module boost.conversion; import std; #endif -import boost.assert; -import boost.throw_exception; - #include #include #include From fa31313f803ee2363c8fd6de44ee2531bdfc026a Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sat, 7 Feb 2026 09:59:03 +0000 Subject: [PATCH 06/29] fix preprocessor order --- include/boost/polymorphic_pointer_cast.hpp | 2 +- modules/boost_conversion.cppm | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/boost/polymorphic_pointer_cast.hpp b/include/boost/polymorphic_pointer_cast.hpp index d4f12dc4..c7c6437f 100644 --- a/include/boost/polymorphic_pointer_cast.hpp +++ b/include/boost/polymorphic_pointer_cast.hpp @@ -18,8 +18,8 @@ # pragma once #endif -#include #if !defined(BOOST_CONVERSION_INTERFACE_UNIT) +# include # include # include #endif diff --git a/modules/boost_conversion.cppm b/modules/boost_conversion.cppm index 8a581ac7..c69ddff4 100644 --- a/modules/boost_conversion.cppm +++ b/modules/boost_conversion.cppm @@ -1,9 +1,5 @@ module; -#ifdef __clang__ -# pragma clang diagnostic ignored "-Winclude-angled-in-module-purview" -#endif - #include #include #include @@ -24,6 +20,10 @@ export module boost.conversion; import std; #endif +#ifdef __clang__ +# pragma clang diagnostic ignored "-Winclude-angled-in-module-purview" +#endif + #include #include #include From 6b6cd752e11faff46e47ed9035ad07961d50010d Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sat, 7 Feb 2026 10:38:07 +0000 Subject: [PATCH 07/29] add mu test --- modules/boost_conversion.cppm | 5 +++++ modules/usage_sample.cpp | 29 ++++++++++++++++++++++++++- modules/usage_test_mu1.cpp | 15 ++++++++++++++ modules/usage_test_mu2.cpp | 10 +++++++++ test/cmake_subdir_test/CMakeLists.txt | 7 ++++++- 5 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 modules/usage_test_mu1.cpp create mode 100644 modules/usage_test_mu2.cpp diff --git a/modules/boost_conversion.cppm b/modules/boost_conversion.cppm index c69ddff4..902dcefe 100644 --- a/modules/boost_conversion.cppm +++ b/modules/boost_conversion.cppm @@ -1,3 +1,8 @@ +// Copyright (c) 2016-2026 Antony Polukhin +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + module; #include diff --git a/modules/usage_sample.cpp b/modules/usage_sample.cpp index 054daafc..f2958d2f 100644 --- a/modules/usage_sample.cpp +++ b/modules/usage_sample.cpp @@ -1,9 +1,36 @@ +// Copyright (c) 2016-2026 Antony Polukhin +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #include +#include +#include import boost.conversion; +namespace { + +struct Base { + virtual ~Base() = default; + virtual std::string name() const { + return "base"; + } +}; + +struct Derived : Base { + std::string name() const override { + return "derived"; + } +}; + +} + int main() { - std::cout << boost::implicit_cast(42); + std::cerr << boost::implicit_cast(42) << '\n'; + + std::unique_ptr base = std::make_unique(); + std::cerr << boost::polymorphic_downcast(*base).name() << '\n'; return 0; } diff --git a/modules/usage_test_mu1.cpp b/modules/usage_test_mu1.cpp new file mode 100644 index 00000000..c8226c38 --- /dev/null +++ b/modules/usage_test_mu1.cpp @@ -0,0 +1,15 @@ +// Copyright (c) 2016-2026 Antony Polukhin +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +long make_me_long(int x); + +int main() { + std::cout << make_me_long(42) << '\n'; + std::cout << boost::implicit_cast(42) << '\n'; +} \ No newline at end of file diff --git a/modules/usage_test_mu2.cpp b/modules/usage_test_mu2.cpp new file mode 100644 index 00000000..bfa72068 --- /dev/null +++ b/modules/usage_test_mu2.cpp @@ -0,0 +1,10 @@ +// Copyright (c) 2016-2026 Antony Polukhin +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +import boost.conversion; + +long make_me_long(int x) { + return boost::implicit_cast(x); +} \ No newline at end of file diff --git a/test/cmake_subdir_test/CMakeLists.txt b/test/cmake_subdir_test/CMakeLists.txt index f1ffaf6a..a7594e47 100644 --- a/test/cmake_subdir_test/CMakeLists.txt +++ b/test/cmake_subdir_test/CMakeLists.txt @@ -18,6 +18,11 @@ enable_testing() if (BOOST_USE_MODULES) add_executable(boost_conversion_module_usage ../../modules/usage_sample.cpp) - target_link_libraries(boost_conversion_module_usage PRIVATE Boost::conversion Boost::smart_ptr) + target_link_libraries(boost_conversion_module_usage PRIVATE Boost::conversion) add_test(NAME boost_conversion_module_usage COMMAND boost_conversion_module_usage) + + # Make sure that mixing includes and imports is fine for different TU + add_executable(boost_conversion_module_usage_mu ../../modules/usage_test_mu1.cpp ../../modules/usage_test_mu2.cpp) + target_link_libraries(boost_conversion_module_usage_mu PRIVATE Boost::conversion) + add_test(NAME boost_conversion_module_usage_mu COMMAND boost_conversion_module_usage_mu) endif() From fbb6b00565d9daa77b2425e38dd6f1b4470fbd5f Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sat, 7 Feb 2026 10:41:59 +0000 Subject: [PATCH 08/29] remove not required includes --- modules/boost_conversion.cppm | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/boost_conversion.cppm b/modules/boost_conversion.cppm index 902dcefe..35667442 100644 --- a/modules/boost_conversion.cppm +++ b/modules/boost_conversion.cppm @@ -6,7 +6,6 @@ module; #include -#include #include #include #include From 1873b23bcf0066bb7afe54607faaeceec576b543 Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sat, 7 Feb 2026 10:47:37 +0000 Subject: [PATCH 09/29] fix newlines --- modules/usage_test_mu1.cpp | 2 +- modules/usage_test_mu2.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/usage_test_mu1.cpp b/modules/usage_test_mu1.cpp index c8226c38..b1fde734 100644 --- a/modules/usage_test_mu1.cpp +++ b/modules/usage_test_mu1.cpp @@ -12,4 +12,4 @@ long make_me_long(int x); int main() { std::cout << make_me_long(42) << '\n'; std::cout << boost::implicit_cast(42) << '\n'; -} \ No newline at end of file +} diff --git a/modules/usage_test_mu2.cpp b/modules/usage_test_mu2.cpp index bfa72068..0b257d38 100644 --- a/modules/usage_test_mu2.cpp +++ b/modules/usage_test_mu2.cpp @@ -7,4 +7,4 @@ import boost.conversion; long make_me_long(int x) { return boost::implicit_cast(x); -} \ No newline at end of file +} From 8cdac8fbf697c7d574a900ab11d485ea605dce19 Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sat, 7 Feb 2026 10:53:45 +0000 Subject: [PATCH 10/29] add copyright --- include/boost/conversion/detail/config.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/boost/conversion/detail/config.hpp b/include/boost/conversion/detail/config.hpp index 507bd28f..f6a7a761 100644 --- a/include/boost/conversion/detail/config.hpp +++ b/include/boost/conversion/detail/config.hpp @@ -1,3 +1,8 @@ +// Copyright (c) 2016-2026 Antony Polukhin +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #ifndef BOOST_CONVERSION_DETAIL_CONFIG_HPP #define BOOST_CONVERSION_DETAIL_CONFIG_HPP From 5f5dcf4e1a3a7ddd0eeebcc9f80dc8493c75cd14 Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sat, 7 Feb 2026 11:31:02 +0000 Subject: [PATCH 11/29] add import std tests --- .github/workflows/ci.yml | 22 +++++++++++++++++++++- CMakeLists.txt | 18 ++++++++++-------- 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 110398ad..e89fd2b0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,7 +32,8 @@ jobs: os: ubuntu-22.04 - toolset: clang-19 compiler: clang++-19 - cxxstd: "20,23,26" + cxxstd: "20,23" + cmake_cxxstd: [20, 23, 26] os: ubuntu-24.04 install: clang-19 llvm-19 libclang-rt-19-dev libc++-19-dev libc++abi-19-dev clang-tools-19 @@ -81,6 +82,24 @@ jobs: cd .. rm -rf __build + - name: Run modules tests + if: ${{matrix.toolset == 'clang-19'}} + run: | + cd ../boost-root/libs/$LIBRARY + cmake -S test/cmake_subdir_test \ + -B build_module \ + -GNinja \ + -DBOOST_USE_MODULES=1 \ + -DBUILD_TESTING=1 \ + -DCMAKE_CXX_STANDARD=${{matrix.cmake_cxxstd}} + -DCMAKE_CXX_COMPILER=clang++-19 \ + -DCMAKE_CXX_MODULE_STD=ON \ + -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=0e5b6991-d74f-4b3d-a41c-cf096e0b2508 \ + -DCMAKE_CXX_FLAGS=-stdlib=libc++ + cmake --build build_module + ctest --test-dir build_module -VV + rm -rf build_module + - name: Run modules tests without 'import std;' if: ${{matrix.toolset == 'clang-19'}} run: | @@ -90,6 +109,7 @@ jobs: -GNinja \ -DBOOST_USE_MODULES=1 \ -DBUILD_TESTING=1 \ + -DCMAKE_CXX_STANDARD=${{matrix.cmake_cxxstd}} \ -DCMAKE_CXX_COMPILER=clang++-19 cmake --build build_module ctest --test-dir build_module -VV diff --git a/CMakeLists.txt b/CMakeLists.txt index c4279897..783b3f82 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,8 +2,8 @@ # Distributed under the Boost Software License, Version 1.0. # See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt -cmake_minimum_required( VERSION 3.5...4.20 ) -project( boost_conversion VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX ) +cmake_minimum_required(VERSION 3.5...4.20) +project(boost_conversion VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX) if (BOOST_USE_MODULES) add_library(boost_conversion) @@ -16,22 +16,24 @@ if (BOOST_USE_MODULES) target_compile_features(boost_conversion PUBLIC cxx_std_20) target_compile_definitions(boost_conversion PUBLIC BOOST_USE_MODULES) - if (CMAKE_CXX_COMPILER_IMPORT_STD AND CMAKE_CXX_MODULE_STD) + get_property(__standard TARGET boost_conversion PROPERTY CXX_STANDARD) + if (__standard IN_LIST CMAKE_CXX_COMPILER_IMPORT_STD) target_compile_definitions(boost_conversion PRIVATE BOOST_CONVERSION_USE_STD_MODULE) message(STATUS "Using `import std;`") else() message(STATUS "`import std;` is not available") endif() + unset(__standard) set(__scope PUBLIC) else() - add_library(boost_conversion INTERFACE ) + add_library(boost_conversion INTERFACE) set(__scope INTERFACE) endif() -target_include_directories( boost_conversion ${__scope} include ) -add_library( Boost::conversion ALIAS boost_conversion ) +target_include_directories(boost_conversion ${__scope} include) +add_library(Boost::conversion ALIAS boost_conversion) -target_link_libraries( boost_conversion +target_link_libraries(boost_conversion ${__scope} Boost::assert Boost::config @@ -39,6 +41,6 @@ target_link_libraries( boost_conversion Boost::smart_ptr ) -if(BUILD_TESTING) +if(BUILD_TESTING AND NOT BOOST_USE_MODULES) add_subdirectory(test) endif() From 2779882a02e43fd57108f6920f2d8127b86a12b9 Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sat, 7 Feb 2026 12:24:27 +0000 Subject: [PATCH 12/29] set standard explicitly --- .github/workflows/ci.yml | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e89fd2b0..bbd31b68 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,7 @@ jobs: strategy: fail-fast: false matrix: + cmake_cxx_standard: ["", 20, 23, 26] include: - toolset: gcc-14 # Do not remove! It is the only toolset that tests CMake tests down below cxxstd: "03,11,14,17,20" @@ -26,14 +27,15 @@ jobs: cxxflags: "cxxflags=--coverage -fsanitize=address,leak,undefined -fno-sanitize-recover=undefined" linkflags: "linkflags=--coverage -lasan -lubsan" gcov_tool: "gcov-12" + cmake_cxx_standard: "" - toolset: clang-14 compiler: clang++-14 cxxstd: "03,11,14,17,2a" os: ubuntu-22.04 + cmake_cxx_standard: "" - toolset: clang-19 compiler: clang++-19 cxxstd: "20,23" - cmake_cxxstd: [20, 23, 26] os: ubuntu-24.04 install: clang-19 llvm-19 libclang-rt-19-dev libc++-19-dev libc++abi-19-dev clang-tools-19 @@ -74,12 +76,13 @@ jobs: if: ${{matrix.toolset == 'gcc-14' || matrix.toolset == 'clang-19'}} run: | cd ../boost-root/ - mkdir __build - cd __build - cmake -DBUILD_TESTING=1 -DBOOST_INCLUDE_LIBRARIES=conversion -DCMAKE_CXX_COMPILER=g++-14 -DCMAKE_C_COMPILER=gcc-14 .. - cmake --build . --target tests + cmake -S . -B __build \ + -DBUILD_TESTING=1 \ + -DBOOST_INCLUDE_LIBRARIES=conversion \ + -DCMAKE_CXX_COMPILER=g++-14 \ + ${{ matrix.cmake_cxx_standard != '' && format('-DCMAKE_CXX_STANDARD={0}', matrix.cmake_cxx_standard) || '' }} + cmake --build __build --target tests ctest --output-on-failure --no-tests=error - cd .. rm -rf __build - name: Run modules tests @@ -91,7 +94,7 @@ jobs: -GNinja \ -DBOOST_USE_MODULES=1 \ -DBUILD_TESTING=1 \ - -DCMAKE_CXX_STANDARD=${{matrix.cmake_cxxstd}} + ${{ matrix.cmake_cxx_standard != '' && format('-DCMAKE_CXX_STANDARD={0}', matrix.cmake_cxx_standard) || '' }} \ -DCMAKE_CXX_COMPILER=clang++-19 \ -DCMAKE_CXX_MODULE_STD=ON \ -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=0e5b6991-d74f-4b3d-a41c-cf096e0b2508 \ @@ -109,7 +112,7 @@ jobs: -GNinja \ -DBOOST_USE_MODULES=1 \ -DBUILD_TESTING=1 \ - -DCMAKE_CXX_STANDARD=${{matrix.cmake_cxxstd}} \ + ${{ matrix.cmake_cxx_standard != '' && format('-DCMAKE_CXX_STANDARD={0}', matrix.cmake_cxx_standard) || '' }} \ -DCMAKE_CXX_COMPILER=clang++-19 cmake --build build_module ctest --test-dir build_module -VV From dac489ad8ad5eb3ad548618da315f1568b1294b3 Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sat, 7 Feb 2026 12:28:32 +0000 Subject: [PATCH 13/29] add test-dir path --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bbd31b68..b0aa2e21 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -82,7 +82,7 @@ jobs: -DCMAKE_CXX_COMPILER=g++-14 \ ${{ matrix.cmake_cxx_standard != '' && format('-DCMAKE_CXX_STANDARD={0}', matrix.cmake_cxx_standard) || '' }} cmake --build __build --target tests - ctest --output-on-failure --no-tests=error + ctest --test-dir __build --output-on-failure --no-tests=error rm -rf __build - name: Run modules tests From 4d5301f89efc2f31f621bb5162ad35a0fff123cd Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sat, 7 Feb 2026 13:25:05 +0000 Subject: [PATCH 14/29] use anchors --- .github/workflows/ci.yml | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b0aa2e21..c90f4a5d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,6 @@ jobs: strategy: fail-fast: false matrix: - cmake_cxx_standard: ["", 20, 23, 26] include: - toolset: gcc-14 # Do not remove! It is the only toolset that tests CMake tests down below cxxstd: "03,11,14,17,20" @@ -27,17 +26,40 @@ jobs: cxxflags: "cxxflags=--coverage -fsanitize=address,leak,undefined -fno-sanitize-recover=undefined" linkflags: "linkflags=--coverage -lasan -lubsan" gcov_tool: "gcov-12" - cmake_cxx_standard: "" - toolset: clang-14 compiler: clang++-14 cxxstd: "03,11,14,17,2a" os: ubuntu-22.04 + - toolset: clang-19 + compiler: clang++-19 + cxxstd: "20,23,26" cmake_cxx_standard: "" + os: ubuntu-24.04 + install: &cxx19 + - clang-19 + - llvm-19 + - libclang-rt-19-dev + - libc++-19-dev + - libc++abi-19-dev + - clang-tools-19 + - toolset: clang-19 + compiler: clang++-19 + cxxstd: "20,23,26" + cmake_cxx_standard: 20 + os: ubuntu-24.04 + install: *cxx19 + - toolset: clang-19 + compiler: clang++-19 + cxxstd: "20,23,26" + cmake_cxx_standard: 23 + os: ubuntu-24.04 + install: *cxx19 - toolset: clang-19 compiler: clang++-19 - cxxstd: "20,23" + cxxstd: "20,23,26" + cmake_cxx_standard: 26 os: ubuntu-24.04 - install: clang-19 llvm-19 libclang-rt-19-dev libc++-19-dev libc++abi-19-dev clang-tools-19 + install: *cxx19 runs-on: ${{matrix.os}} @@ -46,7 +68,7 @@ jobs: - name: Install packages if: matrix.install - run: sudo apt install ${{matrix.install}} + run: sudo apt install -y ${{join(matrix.install, ' ')}} - name: Setup Boost run: | From 57e25a8635d9899dd96ef918919c05ea5d90bb49 Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sat, 7 Feb 2026 13:31:02 +0000 Subject: [PATCH 15/29] better names --- .github/workflows/ci.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c90f4a5d..beaab86e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,7 +32,7 @@ jobs: os: ubuntu-22.04 - toolset: clang-19 compiler: clang++-19 - cxxstd: "20,23,26" + cxxstd: "20" cmake_cxx_standard: "" os: ubuntu-24.04 install: &cxx19 @@ -44,22 +44,24 @@ jobs: - clang-tools-19 - toolset: clang-19 compiler: clang++-19 - cxxstd: "20,23,26" + cxxstd: "20" cmake_cxx_standard: 20 os: ubuntu-24.04 install: *cxx19 - toolset: clang-19 compiler: clang++-19 - cxxstd: "20,23,26" + cxxstd: "23" cmake_cxx_standard: 23 os: ubuntu-24.04 install: *cxx19 - toolset: clang-19 compiler: clang++-19 - cxxstd: "20,23,26" + cxxstd: "26" cmake_cxx_standard: 26 os: ubuntu-24.04 install: *cxx19 + + name: ${{matrix.os}}, ${{matrix.toolset}}, ${{matrix.compiler}}, ${{matrix.cxxstd}} runs-on: ${{matrix.os}} From e8383a0d133ccb594a822ef4aad6ce07e52003ed Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sat, 7 Feb 2026 13:32:39 +0000 Subject: [PATCH 16/29] do not run additional CI --- .github/workflows/ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index beaab86e..31a78c9d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,6 +2,10 @@ name: CI on: pull_request: + branches: + - develop + - feature/** + types: [closed] push: branches: - master From 68d2c683c221116b158fd81e342f5c2e2a788767 Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sat, 7 Feb 2026 13:34:15 +0000 Subject: [PATCH 17/29] better names --- .github/workflows/ci.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 31a78c9d..2708d263 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,11 +31,9 @@ jobs: linkflags: "linkflags=--coverage -lasan -lubsan" gcov_tool: "gcov-12" - toolset: clang-14 - compiler: clang++-14 cxxstd: "03,11,14,17,2a" os: ubuntu-22.04 - toolset: clang-19 - compiler: clang++-19 cxxstd: "20" cmake_cxx_standard: "" os: ubuntu-24.04 @@ -47,25 +45,22 @@ jobs: - libc++abi-19-dev - clang-tools-19 - toolset: clang-19 - compiler: clang++-19 cxxstd: "20" cmake_cxx_standard: 20 os: ubuntu-24.04 install: *cxx19 - toolset: clang-19 - compiler: clang++-19 cxxstd: "23" cmake_cxx_standard: 23 os: ubuntu-24.04 install: *cxx19 - toolset: clang-19 - compiler: clang++-19 cxxstd: "26" cmake_cxx_standard: 26 os: ubuntu-24.04 install: *cxx19 - name: ${{matrix.os}}, ${{matrix.toolset}}, ${{matrix.compiler}}, ${{matrix.cxxstd}} + name: ${{matrix.os}}, ${{matrix.toolset}}, ${{matrix.cxxstd}} runs-on: ${{matrix.os}} From 4aadf22317a4fa85f6e0f3b97655c5071f550080 Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sat, 7 Feb 2026 13:37:30 +0000 Subject: [PATCH 18/29] use matrix compiler --- .github/workflows/ci.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2708d263..ea4fb4ec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,18 +22,22 @@ jobs: matrix: include: - toolset: gcc-14 # Do not remove! It is the only toolset that tests CMake tests down below + compiler: g++-14 cxxstd: "03,11,14,17,20" os: ubuntu-24.04 - toolset: gcc-12 + compiler: g++-12 cxxstd: "03,11,14,17,2a" os: ubuntu-22.04 cxxflags: "cxxflags=--coverage -fsanitize=address,leak,undefined -fno-sanitize-recover=undefined" linkflags: "linkflags=--coverage -lasan -lubsan" gcov_tool: "gcov-12" - toolset: clang-14 + compiler: clang++-14 cxxstd: "03,11,14,17,2a" os: ubuntu-22.04 - toolset: clang-19 + compiler: clang++-19 cxxstd: "20" cmake_cxx_standard: "" os: ubuntu-24.04 @@ -45,16 +49,19 @@ jobs: - libc++abi-19-dev - clang-tools-19 - toolset: clang-19 + compiler: clang++-19 cxxstd: "20" cmake_cxx_standard: 20 os: ubuntu-24.04 install: *cxx19 - toolset: clang-19 + compiler: clang++-19 cxxstd: "23" cmake_cxx_standard: 23 os: ubuntu-24.04 install: *cxx19 - toolset: clang-19 + compiler: clang++-19 cxxstd: "26" cmake_cxx_standard: 26 os: ubuntu-24.04 @@ -102,7 +109,7 @@ jobs: cmake -S . -B __build \ -DBUILD_TESTING=1 \ -DBOOST_INCLUDE_LIBRARIES=conversion \ - -DCMAKE_CXX_COMPILER=g++-14 \ + -DCMAKE_CXX_COMPILER=${{matrix.compiler}} \ ${{ matrix.cmake_cxx_standard != '' && format('-DCMAKE_CXX_STANDARD={0}', matrix.cmake_cxx_standard) || '' }} cmake --build __build --target tests ctest --test-dir __build --output-on-failure --no-tests=error From 028398e84d579cbecf7af9b3a99350a8caa95582 Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sat, 7 Feb 2026 13:37:51 +0000 Subject: [PATCH 19/29] ident --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ea4fb4ec..a416425b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -110,7 +110,7 @@ jobs: -DBUILD_TESTING=1 \ -DBOOST_INCLUDE_LIBRARIES=conversion \ -DCMAKE_CXX_COMPILER=${{matrix.compiler}} \ - ${{ matrix.cmake_cxx_standard != '' && format('-DCMAKE_CXX_STANDARD={0}', matrix.cmake_cxx_standard) || '' }} + ${{ matrix.cmake_cxx_standard != '' && format('-DCMAKE_CXX_STANDARD={0}', matrix.cmake_cxx_standard) || '' }} cmake --build __build --target tests ctest --test-dir __build --output-on-failure --no-tests=error rm -rf __build From e4c0416674eee74cdabd90cc2d918e0bb1552a4d Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sat, 7 Feb 2026 13:38:49 +0000 Subject: [PATCH 20/29] better --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a416425b..40b49ac5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -125,7 +125,7 @@ jobs: -DBOOST_USE_MODULES=1 \ -DBUILD_TESTING=1 \ ${{ matrix.cmake_cxx_standard != '' && format('-DCMAKE_CXX_STANDARD={0}', matrix.cmake_cxx_standard) || '' }} \ - -DCMAKE_CXX_COMPILER=clang++-19 \ + -DCMAKE_CXX_COMPILER=${{matrix.compiler}} \ -DCMAKE_CXX_MODULE_STD=ON \ -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=0e5b6991-d74f-4b3d-a41c-cf096e0b2508 \ -DCMAKE_CXX_FLAGS=-stdlib=libc++ @@ -143,7 +143,7 @@ jobs: -DBOOST_USE_MODULES=1 \ -DBUILD_TESTING=1 \ ${{ matrix.cmake_cxx_standard != '' && format('-DCMAKE_CXX_STANDARD={0}', matrix.cmake_cxx_standard) || '' }} \ - -DCMAKE_CXX_COMPILER=clang++-19 + -DCMAKE_CXX_COMPILER=${{matrix.compiler}} cmake --build build_module ctest --test-dir build_module -VV rm -rf build_module From 16c0bdc6aab6db05ea08cb28abdb1f77c355ae9d Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sat, 7 Feb 2026 13:41:16 +0000 Subject: [PATCH 21/29] ident --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 40b49ac5..06b76216 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -124,7 +124,7 @@ jobs: -GNinja \ -DBOOST_USE_MODULES=1 \ -DBUILD_TESTING=1 \ - ${{ matrix.cmake_cxx_standard != '' && format('-DCMAKE_CXX_STANDARD={0}', matrix.cmake_cxx_standard) || '' }} \ + ${{ matrix.cmake_cxx_standard != '' && format('-DCMAKE_CXX_STANDARD={0}', matrix.cmake_cxx_standard) || '' }} \ -DCMAKE_CXX_COMPILER=${{matrix.compiler}} \ -DCMAKE_CXX_MODULE_STD=ON \ -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=0e5b6991-d74f-4b3d-a41c-cf096e0b2508 \ @@ -142,7 +142,7 @@ jobs: -GNinja \ -DBOOST_USE_MODULES=1 \ -DBUILD_TESTING=1 \ - ${{ matrix.cmake_cxx_standard != '' && format('-DCMAKE_CXX_STANDARD={0}', matrix.cmake_cxx_standard) || '' }} \ + ${{ matrix.cmake_cxx_standard != '' && format('-DCMAKE_CXX_STANDARD={0}', matrix.cmake_cxx_standard) || '' }} \ -DCMAKE_CXX_COMPILER=${{matrix.compiler}} cmake --build build_module ctest --test-dir build_module -VV From 02d5d23f2576ce96db0cee80894d738056ed082a Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sat, 7 Feb 2026 13:45:51 +0000 Subject: [PATCH 22/29] remove unused variable --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 06b76216..11dfa45c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -167,7 +167,7 @@ jobs: echo "$LCOV --directory ../boost-root/bin.v2/libs/$LIBRARY/ --base-directory `pwd`/libs/$LIBRARY/test --capture --output-file $GITHUB_WORKSPACE/coveralls/coverage.info" $LCOV --directory ../boost-root/bin.v2/libs/$LIBRARY/ --base-directory ../boost-root/ --capture --output-file $GITHUB_WORKSPACE/coveralls/coverage.info - $LCOV --remove $GITHUB_WORKSPACE/coveralls/coverage.info "/usr*" "*/$LIBRARY/test/*" ${{matrix.ignore_coverage}} "*/$LIBRARY/tests/*" "*/$LIBRARY/examples/*" "*/$LIBRARY/example/*" -o $GITHUB_WORKSPACE/coveralls/coverage.info + $LCOV --remove $GITHUB_WORKSPACE/coveralls/coverage.info "/usr*" "*/$LIBRARY/test/*" "*/$LIBRARY/tests/*" "*/$LIBRARY/examples/*" "*/$LIBRARY/example/*" -o $GITHUB_WORKSPACE/coveralls/coverage.info cd ../boost-root OTHER_LIBS=`grep "submodule .*" .gitmodules | sed 's/\[submodule\ "\(.*\)"\]/"\*\/boost\/\1\.hpp" "\*\/boost\/\1\/\*"/g'| sed "/\"\*\/boost\/$LIBRARY\/\*\"/d" | sed ':a;N;$!ba;s/\n/ /g'` From d1982301abfe84bed03af324edde3ca7fea03020 Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sat, 7 Feb 2026 13:46:23 +0000 Subject: [PATCH 23/29] return pull request CI --- .github/workflows/ci.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 11dfa45c..fb766fc9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,10 +2,6 @@ name: CI on: pull_request: - branches: - - develop - - feature/** - types: [closed] push: branches: - master From 037ab835f263a8de3d264d066f6918b8c0e0646c Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sat, 7 Feb 2026 13:52:28 +0000 Subject: [PATCH 24/29] fix test build --- CMakeLists.txt | 2 +- test/implicit_cast.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 783b3f82..63aaad86 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,6 +41,6 @@ target_link_libraries(boost_conversion Boost::smart_ptr ) -if(BUILD_TESTING AND NOT BOOST_USE_MODULES) +if(BUILD_TESTING) add_subdirectory(test) endif() diff --git a/test/implicit_cast.cpp b/test/implicit_cast.cpp index 92f21607..a7e27d12 100644 --- a/test/implicit_cast.cpp +++ b/test/implicit_cast.cpp @@ -3,10 +3,11 @@ // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include #include #include +#include + using boost::implicit_cast; using boost::type; From 7a30fccb903446083389ae865d0314d052ab78d1 Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sat, 7 Feb 2026 13:56:15 +0000 Subject: [PATCH 25/29] disable tests again --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 63aaad86..783b3f82 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,6 +41,6 @@ target_link_libraries(boost_conversion Boost::smart_ptr ) -if(BUILD_TESTING) +if(BUILD_TESTING AND NOT BOOST_USE_MODULES) add_subdirectory(test) endif() From f029296665e45fa50c1a7c978960840cf2de69df Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sat, 7 Feb 2026 13:59:46 +0000 Subject: [PATCH 26/29] try add test again --- CMakeLists.txt | 2 +- test/polymorphic_cast_test.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 783b3f82..63aaad86 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,6 +41,6 @@ target_link_libraries(boost_conversion Boost::smart_ptr ) -if(BUILD_TESTING AND NOT BOOST_USE_MODULES) +if(BUILD_TESTING) add_subdirectory(test) endif() diff --git a/test/polymorphic_cast_test.cpp b/test/polymorphic_cast_test.cpp index 26a32514..7a90353a 100644 --- a/test/polymorphic_cast_test.cpp +++ b/test/polymorphic_cast_test.cpp @@ -14,13 +14,14 @@ // #define BOOST_ENABLE_ASSERT_HANDLER -#include -#include #include #include #include #include +#include +#include + #include static bool expect_assertion = false; From aef7a54b9f3fe9d48f8c61b5af2e28edc1e4fb7e Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sun, 8 Feb 2026 12:21:33 +0000 Subject: [PATCH 27/29] fix tests enabling --- test/cmake_subdir_test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/cmake_subdir_test/CMakeLists.txt b/test/cmake_subdir_test/CMakeLists.txt index a7594e47..27728e69 100644 --- a/test/cmake_subdir_test/CMakeLists.txt +++ b/test/cmake_subdir_test/CMakeLists.txt @@ -12,9 +12,9 @@ add_subdirectory(../../../config boostorg/config) add_subdirectory(../../../smart_ptr boostorg/smart_ptr) add_subdirectory(../../../throw_exception boostorg/throw_exception) -add_subdirectory(../../ boostorg/conversion) enable_testing() +add_subdirectory(../../ boostorg/conversion) if (BOOST_USE_MODULES) add_executable(boost_conversion_module_usage ../../modules/usage_sample.cpp) From c77da142e7d8858d3d05dd3787e6dcf41fd8280b Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sun, 8 Feb 2026 12:44:05 +0000 Subject: [PATCH 28/29] cosmetics --- include/boost/conversion/detail/config.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/boost/conversion/detail/config.hpp b/include/boost/conversion/detail/config.hpp index f6a7a761..8b2cf2d2 100644 --- a/include/boost/conversion/detail/config.hpp +++ b/include/boost/conversion/detail/config.hpp @@ -7,10 +7,10 @@ #define BOOST_CONVERSION_DETAIL_CONFIG_HPP #if !defined(BOOST_CONVERSION_INTERFACE_UNIT) -#include -#ifdef BOOST_HAS_PRAGMA_ONCE -#pragma once -#endif +# include +# ifdef BOOST_HAS_PRAGMA_ONCE +# pragma once +# endif #endif #ifdef BOOST_CONVERSION_INTERFACE_UNIT From 7a8d083361a4227dbf5202e9e945e183ab627966 Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sun, 8 Feb 2026 12:44:17 +0000 Subject: [PATCH 29/29] disable assertion fail tests --- test/polymorphic_cast_test.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/polymorphic_cast_test.cpp b/test/polymorphic_cast_test.cpp index 7a90353a..48f74f33 100644 --- a/test/polymorphic_cast_test.cpp +++ b/test/polymorphic_cast_test.cpp @@ -371,14 +371,19 @@ int main() test_polymorphic_pointer_downcast_intrusive(); test_polymorphic_cast_fail(); test_polymorphic_pointer_cast_fail(); + +// NOTE: this tests depend on BOOST_ASSERT macro implementation substitution +// implemented via BOOST_ENABLE_ASSERT_HANDLER macro. +// Such mechanism is not possible with modules because +// module import in TU do not inherit defined TU's macroses. +#ifndef BOOST_USE_MODULES test_polymorphic_downcast_fail(); test_polymorphic_pointer_downcast_builtin_fail(); test_polymorphic_pointer_downcast_boost_shared_fail(); test_polymorphic_pointer_downcast_intrusive_fail(); - test_polymorphic_pointer_downcast_std_shared(); test_polymorphic_pointer_downcast_std_shared_fail(); - +#endif return boost::report_errors(); }