diff --git a/.drone.jsonnet b/.drone.jsonnet index c6881fb..4927b18 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -200,31 +200,38 @@ local windows_pipeline(name, image, environment, arch = "amd64") = ), linux_pipeline( - "Linux 23.04 GCC 13 32 ASAN", + "Linux 23.04 GCC 13 32/64", "cppalliance/droneubuntu2304:1", - { TOOLSET: 'gcc', COMPILER: 'g++-13', CXXSTD: '03,11,14,17,20,2b', ADDRMD: '32' } + asan, + { TOOLSET: 'gcc', COMPILER: 'g++-13', CXXSTD: '03,11,14,17,20,2b', ADDRMD: '32,64' }, "g++-13-multilib", ), linux_pipeline( - "Linux 23.04 GCC 13 64 ASAN", - "cppalliance/droneubuntu2304:1", - { TOOLSET: 'gcc', COMPILER: 'g++-13', CXXSTD: '03,11,14,17,20,2b', ADDRMD: '64' } + asan, - "g++-13-multilib", + "Linux 24.04 GCC 14 32 ASAN", + "cppalliance/droneubuntu2404:1", + { TOOLSET: 'gcc', COMPILER: 'g++-14', CXXSTD: '03,11,14,17,20,2b', ADDRMD: '32' } + asan, + "g++-14-multilib", ), linux_pipeline( - "Linux 23.04 GCC 13 32 UBSAN", - "cppalliance/droneubuntu2304:1", - { TOOLSET: 'gcc', COMPILER: 'g++-13', CXXSTD: '03,11,14,17,20,2b', ADDRMD: '32' } + ubsan, - "g++-13-multilib", + "Linux 24.04 GCC 14 64 ASAN", + "cppalliance/droneubuntu2404:1", + { TOOLSET: 'gcc', COMPILER: 'g++-14', CXXSTD: '03,11,14,17,20,2b', ADDRMD: '64' } + asan, + "g++-14-multilib", ), linux_pipeline( - "Linux 23.04 GCC 13 64 UBSAN", - "cppalliance/droneubuntu2304:1", - { TOOLSET: 'gcc', COMPILER: 'g++-13', CXXSTD: '03,11,14,17,20,2b', ADDRMD: '64' } + ubsan, - "g++-13-multilib", + "Linux 24.04 GCC 14 32 UBSAN", + "cppalliance/droneubuntu2404:1", + { TOOLSET: 'gcc', COMPILER: 'g++-14', CXXSTD: '03,11,14,17,20,2b', ADDRMD: '32' } + ubsan, + "g++-14-multilib", + ), + + linux_pipeline( + "Linux 24.04 GCC 14 64 UBSAN", + "cppalliance/droneubuntu2404:1", + { TOOLSET: 'gcc', COMPILER: 'g++-14', CXXSTD: '03,11,14,17,20,2b', ADDRMD: '64' } + ubsan, + "g++-14-multilib", ), linux_pipeline( @@ -354,17 +361,24 @@ local windows_pipeline(name, image, environment, arch = "amd64") = ), linux_pipeline( - "Linux 23.10 Clang 17 UBSAN", + "Linux 23.10 Clang 17", "cppalliance/droneubuntu2310:1", - { TOOLSET: 'clang', COMPILER: 'clang++-17', CXXSTD: '03,11,14,17,20,2b' } + ubsan, + { TOOLSET: 'clang', COMPILER: 'clang++-17', CXXSTD: '03,11,14,17,20,2b' }, "clang-17", ), linux_pipeline( - "Linux 23.10 Clang 17 ASAN", - "cppalliance/droneubuntu2310:1", - { TOOLSET: 'clang', COMPILER: 'clang++-17', CXXSTD: '03,11,14,17,20,2b' } + asan, - "clang-17", + "Linux 24.04 Clang 18 UBSAN", + "cppalliance/droneubuntu2404:1", + { TOOLSET: 'clang', COMPILER: 'clang++-18', CXXSTD: '03,11,14,17,20,2b' } + ubsan, + "clang-18", + ), + + linux_pipeline( + "Linux 24.04 Clang 18 ASAN", + "cppalliance/droneubuntu2404:1", + { TOOLSET: 'clang', COMPILER: 'clang++-18', CXXSTD: '03,11,14,17,20,2b' } + asan, + "clang-18", ), macos_pipeline( diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d4bdfc6..9408e6b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -128,6 +128,13 @@ jobs: container: ubuntu:23.04 install: - g++-13-multilib + - toolset: gcc-14 + cxxstd: "03,11,14,17,20,23" + address-model: 32,64 + os: ubuntu-latest + container: ubuntu:24.04 + install: + - g++-14-multilib - name: UBSAN toolset: gcc-12 cxxstd: "03,11,14,17,20,23" @@ -286,15 +293,23 @@ jobs: - toolset: clang compiler: clang++-17 cxxstd: "03,11,14,17,20,2b" - os: ubuntu-22.04 + os: ubuntu-latest + container: ubuntu:23.10 install: - clang-17 - libc++-17-dev - libc++abi-17-dev - sources: - - "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main" - source_keys: - - "https://apt.llvm.org/llvm-snapshot.gpg.key" + cxxflags: -stdlib=libc++ + linkflags: -stdlib=libc++ + - toolset: clang + compiler: clang++-18 + cxxstd: "03,11,14,17,20,2b" + os: ubuntu-latest + container: ubuntu:24.04 + install: + - clang-18 + - libc++-18-dev + - libc++abi-18-dev cxxflags: -stdlib=libc++ linkflags: -stdlib=libc++ - name: UBSAN diff --git a/include/boost/core/empty_value.hpp b/include/boost/core/empty_value.hpp index bb95841..5eeee51 100644 --- a/include/boost/core/empty_value.hpp +++ b/include/boost/core/empty_value.hpp @@ -96,8 +96,10 @@ private: #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) #if defined(BOOST_MSVC) -// This is a workaround to an MSVC bug when T is a nested class. -// See https://developercommunity.visualstudio.com/t/Compiler-bug:-Incorrect-C2247-and-C2248/10690025 +/* +This is a workaround to an MSVC bug when T is a nested class: +https://developercommunity.visualstudio.com/t/Compiler-bug:-Incorrect-C2247-and-C2248/10690025 +*/ namespace detail { template @@ -138,10 +140,10 @@ template class empty_value #if defined(BOOST_MSVC) : detail::empty_value_base { - typedef detail::empty_value_base base; + typedef detail::empty_value_base empty_base_; #else : T { - typedef T base; + typedef T empty_base_; #endif public: @@ -154,26 +156,26 @@ public: #endif BOOST_CONSTEXPR empty_value(boost::empty_init_t) - : base() { } + : empty_base_() { } #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template BOOST_CONSTEXPR empty_value(boost::empty_init_t, U&& value, Args&&... args) - : base(std::forward(value), std::forward(args)...) { } + : empty_base_(std::forward(value), std::forward(args)...) { } #else template BOOST_CONSTEXPR empty_value(boost::empty_init_t, U&& value) - : base(std::forward(value)) { } + : empty_base_(std::forward(value)) { } #endif #else template BOOST_CONSTEXPR empty_value(boost::empty_init_t, const U& value) - : base(value) { } + : empty_base_(value) { } template BOOST_CONSTEXPR empty_value(boost::empty_init_t, U& value) - : base(value) { } + : empty_base_(value) { } #endif BOOST_CONSTEXPR const T& get() const BOOST_NOEXCEPT { diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 7e5c104..f921d70 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -229,6 +229,7 @@ run empty_value_test.cpp ; run empty_value_size_test.cpp ; run empty_value_final_test.cpp ; run empty_value_constexpr_test.cpp ; +compile empty_value_nested_test.cpp ; compile-fail empty_value_compile_fail_casting.cpp ; run quick_exit_test.cpp ; diff --git a/test/empty_value_nested_test.cpp b/test/empty_value_nested_test.cpp new file mode 100644 index 0000000..7c011a5 --- /dev/null +++ b/test/empty_value_nested_test.cpp @@ -0,0 +1,45 @@ +/* +Copyright 2024 Braden Ganetsky +(glenjofe@gmail.com) + +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) +*/ +#include + +/* +Tests workaround for MSVC bug: +https://developercommunity.visualstudio.com/t/Compiler-bug:-Incorrect-C2247-and-C2248/10690025 +*/ +template +struct derived + : boost::empty_value { + typedef typename boost::empty_value::type type; + derived(boost::empty_init_t e) + : boost::empty_value(e) { } +}; + +struct outer { + struct inner_empty { }; + struct inner_non_empty { + inner_non_empty() + : value() { } + int value; + }; +}; + +void test() +{ + const boost::empty_value x1(boost::empty_init); + (void)x1; + const boost::empty_value x2(boost::empty_init); + (void)x2; + const boost::empty_value x3(boost::empty_init); + (void)x3; + const derived x4(boost::empty_init); + (void)x4; + const derived x5(boost::empty_init); + (void)x5; + const derived x6(boost::empty_init); + (void)x6; +} diff --git a/test/empty_value_test.cpp b/test/empty_value_test.cpp index 44dba4c..b7cf796 100644 --- a/test/empty_value_test.cpp +++ b/test/empty_value_test.cpp @@ -63,40 +63,6 @@ void test_type() BOOST_TEST(v2.get().value() == 6); } -template -struct derived : boost::empty_value { - typedef typename boost::empty_value::type type; - derived(boost::empty_init_t e) : boost::empty_value(e) {} -}; - -struct outer { - struct inner_empty {}; - struct inner_non_empty { - inner_non_empty() : value() {} - int value; - }; -}; - -void test_derived_compile() -{ - // This is testing the workaround to an MSVC bug when T is a nested class. - // See https://developercommunity.visualstudio.com/t/Compiler-bug:-Incorrect-C2247-and-C2248/10690025 - - const boost::empty_value x1(boost::empty_init); - const boost::empty_value x2(boost::empty_init); - const boost::empty_value x3(boost::empty_init); - const derived x4(boost::empty_init); - const derived x5(boost::empty_init); - const derived x6(boost::empty_init); - - (void)x1; - (void)x2; - (void)x3; - (void)x4; - (void)x5; - (void)x6; -} - int main() { test_int();