Compare commits

..

7 Commits

Author SHA1 Message Date
Peter Dimov 2698b43803 Update revision history 2026-05-12 02:42:47 +03:00
Peter Dimov c745320880 Update .drone.jsonnet 2026-05-12 01:59:03 +03:00
Peter Dimov e32dbe5013 Update ci.yml 2026-05-11 22:46:20 +03:00
Peter Dimov 1e51179fc7 Disable hash_variant_test2 under Clang < 7.1 2026-05-11 22:32:13 +03:00
Peter Dimov 3e27ff182c Avoid libstdc++'s never valueless optimization 2026-05-11 22:08:25 +03:00
Peter Dimov 68fabb1a8e Do not throw an exception when hashing valueless std::variant values 2026-05-11 21:23:29 +03:00
Peter Dimov 8d5ae8536f Add a test for valueless std::variant values 2026-05-11 21:19:32 +03:00
6 changed files with 112 additions and 21 deletions
+22 -10
View File
@@ -102,7 +102,6 @@ local windows_pipeline(name, image, environment, arch = "amd64") =
"cppalliance/droneubuntu1404:1",
{ TOOLSET: 'gcc', COMPILER: 'g++-4.7', CXXSTD: '0x', ADDRMD: '32,64' },
"g++-4.7-multilib",
[ "ppa:ubuntu-toolchain-r/test" ],
),
linux_pipeline(
@@ -112,11 +111,10 @@ local windows_pipeline(name, image, environment, arch = "amd64") =
),
linux_pipeline(
"Linux 14.04 GCC 4.9 32/64",
"cppalliance/droneubuntu1404:1",
"Linux 16.04 GCC 4.9 32/64",
"cppalliance/droneubuntu1604:1",
{ TOOLSET: 'gcc', COMPILER: 'g++-4.9', CXXSTD: '11', ADDRMD: '32,64' },
"g++-4.9-multilib",
[ "ppa:ubuntu-toolchain-r/test" ],
),
linux_pipeline(
@@ -214,19 +212,26 @@ local windows_pipeline(name, image, environment, arch = "amd64") =
),
linux_pipeline(
"Linux 25.10 GCC 15 UBSAN",
"cppalliance/droneubuntu2510:1",
"Linux 26.04 GCC 15 UBSAN",
"cppalliance/droneubuntu2604:1",
{ TOOLSET: 'gcc', COMPILER: 'g++-15', CXXSTD: '11,14,17,20,23,2c' } + ubsan,
"g++-15-multilib",
),
linux_pipeline(
"Linux 25.10 GCC 15 ASAN",
"cppalliance/droneubuntu2510:1",
"Linux 26.04 GCC 15 ASAN",
"cppalliance/droneubuntu2604:1",
{ TOOLSET: 'gcc', COMPILER: 'g++-15', CXXSTD: '11,14,17,20,23,2c' } + asan,
"g++-15-multilib",
),
linux_pipeline(
"Linux 26.04 GCC 16",
"cppalliance/droneubuntu2604:1",
{ TOOLSET: 'gcc', COMPILER: 'g++-16', CXXSTD: '11,14,17,20,23,2c' },
"g++-16-multilib",
),
linux_pipeline(
"Linux 16.04 Clang 3.5",
"cppalliance/droneubuntu1604:1",
@@ -389,12 +394,19 @@ local windows_pipeline(name, image, environment, arch = "amd64") =
),
linux_pipeline(
"Linux 25.10 Clang 21",
"cppalliance/droneubuntu2510:1",
"Linux 26.04 Clang 21",
"cppalliance/droneubuntu2604:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-21', CXXSTD: '11,14,17,20,23,2c' },
"clang-21",
),
linux_pipeline(
"Linux 26.04 Clang 22",
"cppalliance/droneubuntu2604:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-22', CXXSTD: '11,14,17,20,23,2c' },
"clang-22",
),
macos_pipeline(
"MacOS 10.15 Xcode 12.2 UBSAN",
{ TOOLSET: 'clang', COMPILER: 'clang++', CXXSTD: '11,14,17,2a' } + ubsan,
+21 -10
View File
@@ -67,10 +67,16 @@ jobs:
address-model: 32,64
- toolset: gcc-15
cxxstd: "11,14,17,20,23,2c"
container: ubuntu:25.10
container: ubuntu:26.04
os: ubuntu-latest
install: g++-15-multilib
address-model: 32,64
- toolset: gcc-16
cxxstd: "11,14,17,20,23,2c"
container: ubuntu:26.04
os: ubuntu-latest
install: g++-16-multilib
address-model: 32,64
- toolset: clang
compiler: clang++-6.0
cxxstd: "11,14,17"
@@ -164,9 +170,15 @@ jobs:
- toolset: clang
compiler: clang++-21
cxxstd: "11,14,17,20,23,2c"
container: ubuntu:25.10
container: ubuntu:26.04
os: ubuntu-latest
install: clang-21
- toolset: clang
compiler: clang++-22
cxxstd: "11,14,17,20,23,2c"
container: ubuntu:26.04
os: ubuntu-latest
install: clang-22
- toolset: clang
cxxstd: "11,14,17,20,2b"
os: macos-14
@@ -178,12 +190,7 @@ jobs:
os: macos-26
runs-on: ${{matrix.os}}
container:
image: ${{matrix.container}}
volumes:
- /node20217:/node20217:rw,rshared
- ${{ startsWith(matrix.container, 'ubuntu:1') && '/node20217:/__e/node20:ro,rshared' || ' ' }}
container: ${{matrix.container}}
defaults:
run:
@@ -247,14 +254,18 @@ jobs:
cxxstd: "14,17,20,latest"
addrmd: 32,64
os: windows-2022
- toolset: msvc-14.5
cxxstd: "14,17,20,latest"
addrmd: 32,64
os: windows-2025-vs2026
- toolset: clang-win
cxxstd: "14,17,20,latest"
addrmd: 32,64
os: windows-2022
os: windows-2025
- toolset: gcc
cxxstd: "11,14,17,2a"
addrmd: 64
os: windows-2022
os: windows-2025
runs-on: ${{matrix.os}}
+4
View File
@@ -8,6 +8,10 @@ https://www.boost.org/LICENSE_1_0.txt
= Recent Changes
:idprefix: recent_
== Boost 1.92.0
* Hashing a valueless `std::variant` instance no longer throws.
== Boost 1.89.0
* Added the `hash_is_avalanching` trait class.
+5 -1
View File
@@ -455,7 +455,11 @@ namespace boost
std::size_t seed = 0;
hash_combine( seed, v.index() );
std::visit( [&seed](auto&& x) { hash_combine(seed, x); }, v );
if( !v.valueless_by_exception() )
{
std::visit( [&seed](auto&& x) { hash_combine(seed, x); }, v );
}
return seed;
}
+2
View File
@@ -135,3 +135,5 @@ run hash_tuple_like_test2.cpp
run is_range_test4.cpp ;
run hash_container_test2.cpp ;
run hash_variant_test2.cpp ;
+58
View File
@@ -0,0 +1,58 @@
// Copyright 2026 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
#include <boost/container_hash/hash.hpp>
#include <boost/config.hpp>
#include <boost/config/pragma_message.hpp>
#if defined(BOOST_NO_CXX17_HDR_VARIANT)
BOOST_PRAGMA_MESSAGE( "Skipping test because BOOST_NO_CXX17_HDR_VARIANT is defined" )
int main() {}
#elif defined(BOOST_CLANG_VERSION) && BOOST_CLANG_VERSION < 70100
BOOST_PRAGMA_MESSAGE( "Skipping test because BOOST_CLANG_VERSION < 70100" )
int main() {}
#else
#include <boost/core/lightweight_test.hpp>
#include <variant>
#include <set>
struct X
{
operator std::set<float>() const { throw 5; }
};
using V = std::variant<std::set<int>, std::set<float>>;
V make_valueless_variant()
{
V v;
try
{
v.emplace<1>( X() );
}
catch( int )
{
}
BOOST_TEST( v.valueless_by_exception() );
return v;
}
int main()
{
V v1, v2 = make_valueless_variant();
BOOST_TEST_NE( (boost::hash<V>()( v1 )), (boost::hash<V>()( v2 )) );
return boost::report_errors();
}
#endif