forked from boostorg/core
Compare commits
43 Commits
feature/mi
...
boost-1.87
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e3a2e88e4c | ||
|
|
5e451b6c84 | ||
|
|
88a957b21c | ||
|
|
1bac0ccfd1 | ||
|
|
602961e526 | ||
|
|
366802b43c | ||
|
|
9dd0a8e1e4 | ||
|
|
622476533c | ||
|
|
a09ee19e3e | ||
|
|
040b018ce0 | ||
|
|
42d0c5954a | ||
|
|
76d0f22d3b | ||
|
|
243eec26fe | ||
|
|
44c32d7691 | ||
|
|
0ee7dc5910 | ||
|
|
9e9e6e3898 | ||
|
|
242b14bb69 | ||
|
|
76061d91d4 | ||
|
|
bda05a7812 | ||
|
|
d66b8c1c13 | ||
|
|
bd29e0dd15 | ||
|
|
72761e34e0 | ||
|
|
983234baee | ||
|
|
83a3a51bee | ||
|
|
acbeaae181 | ||
|
|
d01b4e94cc | ||
|
|
e22bd49fa7 | ||
|
|
c056f3dfc9 | ||
|
|
8b8944dd6e | ||
|
|
278d3f0060 | ||
|
|
3f36d507f2 | ||
|
|
a77338b1cd | ||
|
|
a8c757ddf2 | ||
|
|
98a055cf34 | ||
|
|
074a467d9d | ||
|
|
965508d9e1 | ||
|
|
0a238bb30d | ||
|
|
d03e58b77e | ||
|
|
b18495fe35 | ||
|
|
151d0c4143 | ||
|
|
25b0defdeb | ||
|
|
541745ea24 | ||
|
|
5f825106c7 |
@@ -32,6 +32,8 @@ local linux_pipeline(name, image, environment, packages = "", sources = [], arch
|
||||
commands:
|
||||
[
|
||||
'set -e',
|
||||
'uname -a',
|
||||
'echo $DRONE_STAGE_MACHINE',
|
||||
'wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -',
|
||||
] +
|
||||
(if sources != [] then [ ('apt-add-repository "' + source + '"') for source in sources ] else []) +
|
||||
@@ -200,31 +202,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 +363,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(
|
||||
|
||||
37
.github/workflows/ci.yml
vendored
37
.github/workflows/ci.yml
vendored
@@ -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
|
||||
@@ -310,15 +325,15 @@ jobs:
|
||||
- libc++-15-dev
|
||||
- libc++abi-15-dev
|
||||
|
||||
- toolset: clang
|
||||
cxxstd: "03,11,14,17,2a"
|
||||
os: macos-11
|
||||
- toolset: clang
|
||||
cxxstd: "03,11,14,17,20,2b"
|
||||
os: macos-12
|
||||
- toolset: clang
|
||||
cxxstd: "03,11,14,17,20,2b"
|
||||
os: macos-13
|
||||
- toolset: clang
|
||||
cxxstd: "03,11,14,17,20,2b"
|
||||
os: macos-14
|
||||
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{matrix.os}}
|
||||
@@ -611,9 +626,9 @@ jobs:
|
||||
include:
|
||||
- os: ubuntu-20.04
|
||||
- os: ubuntu-22.04
|
||||
- os: macos-11
|
||||
- os: macos-12
|
||||
- os: macos-13
|
||||
- os: macos-14
|
||||
|
||||
runs-on: ${{matrix.os}}
|
||||
timeout-minutes: 10
|
||||
@@ -678,9 +693,9 @@ jobs:
|
||||
include:
|
||||
- os: ubuntu-20.04
|
||||
- os: ubuntu-22.04
|
||||
- os: macos-11
|
||||
- os: macos-12
|
||||
- os: macos-13
|
||||
- os: macos-14
|
||||
|
||||
runs-on: ${{matrix.os}}
|
||||
timeout-minutes: 10
|
||||
@@ -755,9 +770,9 @@ jobs:
|
||||
include:
|
||||
- os: ubuntu-20.04
|
||||
- os: ubuntu-22.04
|
||||
- os: macos-11
|
||||
- os: macos-12
|
||||
- os: macos-13
|
||||
- os: macos-14
|
||||
|
||||
runs-on: ${{matrix.os}}
|
||||
timeout-minutes: 20
|
||||
|
||||
23
build.jam
Normal file
23
build.jam
Normal file
@@ -0,0 +1,23 @@
|
||||
# Copyright 2023-2024 René Ferdinand Rivera Morell
|
||||
# Copyright 2024 Peter Dimov
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
require-b2 5.2 ;
|
||||
|
||||
constant boost_dependencies :
|
||||
/boost/assert//boost_assert
|
||||
/boost/config//boost_config
|
||||
/boost/static_assert//boost_static_assert
|
||||
/boost/throw_exception//boost_throw_exception
|
||||
;
|
||||
|
||||
project /boost/core ;
|
||||
|
||||
explicit
|
||||
[ alias boost_core : : : : <include>include <library>$(boost_dependencies) ]
|
||||
[ alias all : boost_core test ]
|
||||
;
|
||||
|
||||
call-if : boost-library core
|
||||
;
|
||||
@@ -9,7 +9,7 @@ import project ;
|
||||
import doxygen ;
|
||||
import quickbook ;
|
||||
|
||||
path-constant INCLUDES : ../../.. ;
|
||||
path-constant INCLUDES : ../include ;
|
||||
|
||||
doxygen ref_reference
|
||||
:
|
||||
|
||||
@@ -7,12 +7,24 @@
|
||||
|
||||
[section Revision History]
|
||||
|
||||
[section Changes in 1.86.0]
|
||||
|
||||
* Added a [link core.pointer_in_range `boost/core/pointer_in_range.hpp`] header with a `pointer_in_range`
|
||||
function template to check if a pointer is within a given range.
|
||||
* Fixed `type_name` for abstract classes. ([github_issue 172])
|
||||
* Fixed `boost/core/type_name.hpp` compilation error with MSVC with disabled native `wchar_t` type.
|
||||
([github_issue 173])
|
||||
* Added a workaround for an MSVC [@https://developercommunity.visualstudio.com/t/Compiler-bug:-Incorrect-C2247-and-C2248/10690025 bug]
|
||||
causing `empty_value` compilation errors when it is used with a nested class. ([github_pr 175])
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Changes in 1.85.0]
|
||||
|
||||
* Added a new [link core.functor `boost/core/functor.hpp`] header with a `functor` class template
|
||||
for wrapping a raw function into a function object class.
|
||||
* Changed [link core.null_deleter `null_deleter`], [link core.fclose_deleter `fclose_deleter`]
|
||||
and [link.checked_delete checked deleter] definitions so that they don't bring namespace `boost`
|
||||
and [link core.checked_delete checked deleter] definitions so that they don't bring namespace `boost`
|
||||
into argument-dependent lookup in cases like this:
|
||||
```
|
||||
std::unique_ptr< std::FILE, boost::fclose_deleter > p1, p2;
|
||||
|
||||
@@ -20,6 +20,9 @@ or copy at http://boost.org/LICENSE_1_0.txt)
|
||||
]
|
||||
]
|
||||
|
||||
[template github_issue[key]'''<ulink url="https://github.com/boostorg/core/issues/'''[key]'''">#'''[key]'''</ulink>''']
|
||||
[template github_pr[key]'''<ulink url="https://github.com/boostorg/core/pull/'''[key]'''">PR#'''[key]'''</ulink>''']
|
||||
|
||||
[template simplesect[title]
|
||||
[block '''<simplesect><title>'''[title]'''</title>''']]
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ constexpr bool pointer_in_range(const T* ptr, const T* begin, const T* end);
|
||||
|
||||
[variablelist
|
||||
[[`template<class T> constexpr bool pointer_in_range(const T* ptr,
|
||||
const T* begin, T* end);`]
|
||||
const T* begin, const T* end);`]
|
||||
[[variablelist
|
||||
[[Requires][`[begin,end)` is a valid range.]]
|
||||
[[Returns][`true` if `ptr` is in range `[begin,end)`, otherwise `false`.]]]]]]
|
||||
|
||||
@@ -95,9 +95,57 @@ 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:
|
||||
https://developercommunity.visualstudio.com/t/Compiler-bug:-Incorrect-C2247-and-C2248/10690025
|
||||
*/
|
||||
namespace detail {
|
||||
|
||||
template<class T>
|
||||
class empty_value_base
|
||||
: public T {
|
||||
public:
|
||||
#if !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS)
|
||||
empty_value_base() = default;
|
||||
#else
|
||||
BOOST_CONSTEXPR empty_value_base() { }
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
template<class U, class... Args>
|
||||
BOOST_CONSTEXPR empty_value_base(U&& value, Args&&... args)
|
||||
: T(std::forward<U>(value), std::forward<Args>(args)...) { }
|
||||
#else
|
||||
template<class U>
|
||||
BOOST_CONSTEXPR empty_value_base(U&& value)
|
||||
: T(std::forward<U>(value)) { }
|
||||
#endif
|
||||
#else
|
||||
template<class U>
|
||||
BOOST_CONSTEXPR empty_value_base(const U& value)
|
||||
: T(value) { }
|
||||
|
||||
template<class U>
|
||||
BOOST_CONSTEXPR empty_value_base(U& value)
|
||||
: T(value) { }
|
||||
#endif
|
||||
};
|
||||
|
||||
} /* detail */
|
||||
#endif
|
||||
|
||||
template<class T, unsigned N>
|
||||
class empty_value<T, N, true>
|
||||
#if defined(BOOST_MSVC)
|
||||
: detail::empty_value_base<T> {
|
||||
typedef detail::empty_value_base<T> empty_base_;
|
||||
#else
|
||||
: T {
|
||||
typedef T empty_base_;
|
||||
#endif
|
||||
|
||||
public:
|
||||
typedef T type;
|
||||
|
||||
@@ -108,26 +156,26 @@ public:
|
||||
#endif
|
||||
|
||||
BOOST_CONSTEXPR empty_value(boost::empty_init_t)
|
||||
: T() { }
|
||||
: empty_base_() { }
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
template<class U, class... Args>
|
||||
BOOST_CONSTEXPR empty_value(boost::empty_init_t, U&& value, Args&&... args)
|
||||
: T(std::forward<U>(value), std::forward<Args>(args)...) { }
|
||||
: empty_base_(std::forward<U>(value), std::forward<Args>(args)...) { }
|
||||
#else
|
||||
template<class U>
|
||||
BOOST_CONSTEXPR empty_value(boost::empty_init_t, U&& value)
|
||||
: T(std::forward<U>(value)) { }
|
||||
: empty_base_(std::forward<U>(value)) { }
|
||||
#endif
|
||||
#else
|
||||
template<class U>
|
||||
BOOST_CONSTEXPR empty_value(boost::empty_init_t, const U& value)
|
||||
: T(value) { }
|
||||
: empty_base_(value) { }
|
||||
|
||||
template<class U>
|
||||
BOOST_CONSTEXPR empty_value(boost::empty_init_t, U& value)
|
||||
: T(value) { }
|
||||
: empty_base_(value) { }
|
||||
#endif
|
||||
|
||||
BOOST_CONSTEXPR const T& get() const BOOST_NOEXCEPT {
|
||||
|
||||
@@ -103,7 +103,8 @@ inline std::string fix_typeid_name( char const* n )
|
||||
}
|
||||
|
||||
// class types can be incomplete
|
||||
template<class T> std::string typeid_name_impl( int T::* )
|
||||
// but also abstract (T[1] doesn't form)
|
||||
template<class T> std::string typeid_name_impl( int T::*, T(*)[1] )
|
||||
{
|
||||
std::string r = fix_typeid_name( typeid(T[1]).name() );
|
||||
return r.substr( 0, r.size() - 4 ); // remove ' [1]' suffix
|
||||
@@ -116,7 +117,7 @@ template<class T> std::string typeid_name_impl( ... )
|
||||
|
||||
template<class T> std::string typeid_name()
|
||||
{
|
||||
return typeid_name_impl<T>( 0 );
|
||||
return typeid_name_impl<T>( 0, 0 );
|
||||
}
|
||||
|
||||
// template names
|
||||
@@ -345,6 +346,8 @@ template<> struct tn_holder<boost::uint128_type>
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_INTRINSIC_WCHAR_T)
|
||||
|
||||
template<> struct tn_holder<wchar_t>
|
||||
{
|
||||
static std::string type_name( std::string const& suffix )
|
||||
@@ -353,6 +356,8 @@ template<> struct tn_holder<wchar_t>
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_CHAR16_T)
|
||||
|
||||
template<> struct tn_holder<char16_t>
|
||||
|
||||
@@ -6,11 +6,15 @@
|
||||
# See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
require-b2 5.0.1 ;
|
||||
import-search /boost/config/checks ;
|
||||
import config : requires ;
|
||||
import modules ;
|
||||
import testing ;
|
||||
|
||||
project : requirements
|
||||
|
||||
<library>/boost/core//boost_core
|
||||
<library>/boost/type_traits//boost_type_traits
|
||||
<warnings>extra
|
||||
<toolset>msvc:<warnings-as-errors>on
|
||||
<toolset>clang:<warnings-as-errors>on
|
||||
@@ -197,7 +201,7 @@ run underlying_type.cpp ;
|
||||
compile-fail null_deleter_compile_fail_adl.cpp
|
||||
: $(warnings-as-errors-off) ;
|
||||
|
||||
run fclose_deleter_test.cpp : : : <target-os>windows:<define>_CRT_SECURE_NO_WARNINGS <target-os>windows:<define>_CRT_SECURE_NO_DEPRECATE ;
|
||||
run fclose_deleter_test.cpp /boost/move//boost_move /boost/smart_ptr//boost_smart_ptr : : : <target-os>windows:<define>_CRT_SECURE_NO_WARNINGS <target-os>windows:<define>_CRT_SECURE_NO_DEPRECATE ;
|
||||
compile-fail fclose_deleter_compile_fail_adl.cpp
|
||||
: <target-os>windows:<define>_CRT_SECURE_NO_WARNINGS <target-os>windows:<define>_CRT_SECURE_NO_DEPRECATE $(warnings-as-errors-off) ;
|
||||
|
||||
@@ -226,6 +230,8 @@ 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 ;
|
||||
run-fail quick_exit_fail.cpp ;
|
||||
@@ -379,7 +385,7 @@ run sv_stream_insert_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_conversion_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_conversion_test2.cpp : ;
|
||||
run sv_conversion_test2.cpp /boost/utility//boost_utility : ;
|
||||
run sv_common_reference_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
compile sv_common_reference_test2.cpp ;
|
||||
@@ -417,11 +423,9 @@ run memory_resource_test.cpp ;
|
||||
run data_test.cpp ;
|
||||
run size_test.cpp ;
|
||||
|
||||
import ../../config/checks/config : requires ;
|
||||
local CPP11 = [ requires cxx11_variadic_templates cxx11_template_aliases cxx11_decltype cxx11_constexpr cxx11_noexcept cxx11_ref_qualifiers ] ;
|
||||
|
||||
local CPP11 = [ requires cxx11_variadic_templates cxx11_template_aliases cxx11_decltype cxx11_constexpr cxx11_noexcept ] ;
|
||||
|
||||
local with-serialization = <library>/boost//serialization/<warnings>off $(warnings-as-errors-off) <undefined-sanitizer>norecover:<link>static $(CPP11) ;
|
||||
local with-serialization = <library>/boost/serialization//boost_serialization/<warnings>off $(warnings-as-errors-off) <undefined-sanitizer>norecover:<link>static $(CPP11) ;
|
||||
|
||||
run serialization_nvp_test.cpp : : : $(with-serialization) <undefined-sanitizer>norecover:<build>no ;
|
||||
run serialization_split_free_test.cpp : : : $(with-serialization) ;
|
||||
|
||||
@@ -14,4 +14,4 @@ target_link_libraries(quick Boost::core)
|
||||
enable_testing()
|
||||
add_test(quick quick)
|
||||
|
||||
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
|
||||
add_custom_target(check VERBATIM COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
|
||||
|
||||
@@ -18,4 +18,4 @@ target_link_libraries(quick Boost::core)
|
||||
enable_testing()
|
||||
add_test(quick quick)
|
||||
|
||||
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
|
||||
add_custom_target(check VERBATIM COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
|
||||
|
||||
20
test/empty_value_compile_fail_casting.cpp
Normal file
20
test/empty_value_compile_fail_casting.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
// Copyright 2024 Braden Ganetsky
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/core/empty_value.hpp>
|
||||
|
||||
struct empty {};
|
||||
|
||||
// This test ensures private inheritance of `boost::empty_value<T>` for empty `T`.
|
||||
// With public inheritance, `boost::empty_value<empty>*` could cast to `empty*`.
|
||||
void test_empty_not_convertible_to_base()
|
||||
{
|
||||
const boost::empty_value<empty> x(boost::empty_init);
|
||||
const empty* x2 = static_cast<const empty*>(&x);
|
||||
(void)x2;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
}
|
||||
45
test/empty_value_nested_test.cpp
Normal file
45
test/empty_value_nested_test.cpp
Normal file
@@ -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 <boost/core/empty_value.hpp>
|
||||
|
||||
/*
|
||||
Tests workaround for MSVC bug:
|
||||
https://developercommunity.visualstudio.com/t/Compiler-bug:-Incorrect-C2247-and-C2248/10690025
|
||||
*/
|
||||
template<class T>
|
||||
struct derived
|
||||
: boost::empty_value<T> {
|
||||
typedef typename boost::empty_value<T>::type type;
|
||||
derived(boost::empty_init_t e)
|
||||
: boost::empty_value<T>(e) { }
|
||||
};
|
||||
|
||||
struct outer {
|
||||
struct inner_empty { };
|
||||
struct inner_non_empty {
|
||||
inner_non_empty()
|
||||
: value() { }
|
||||
int value;
|
||||
};
|
||||
};
|
||||
|
||||
void test()
|
||||
{
|
||||
const boost::empty_value<outer> x1(boost::empty_init);
|
||||
(void)x1;
|
||||
const boost::empty_value<outer::inner_empty> x2(boost::empty_init);
|
||||
(void)x2;
|
||||
const boost::empty_value<outer::inner_non_empty> x3(boost::empty_init);
|
||||
(void)x3;
|
||||
const derived<outer> x4(boost::empty_init);
|
||||
(void)x4;
|
||||
const derived<outer::inner_empty> x5(boost::empty_init);
|
||||
(void)x5;
|
||||
const derived<outer::inner_non_empty> x6(boost::empty_init);
|
||||
(void)x6;
|
||||
}
|
||||
@@ -55,6 +55,13 @@ template<class T1, class T2> struct X
|
||||
|
||||
template<class T1, class T2> struct Y;
|
||||
|
||||
class W
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void f() = 0;
|
||||
};
|
||||
|
||||
enum E1
|
||||
{
|
||||
e1
|
||||
@@ -122,6 +129,7 @@ int main()
|
||||
TEST(A);
|
||||
TEST(B);
|
||||
TEST(C);
|
||||
TEST(W);
|
||||
|
||||
TEST(E1);
|
||||
|
||||
@@ -143,6 +151,9 @@ int main()
|
||||
TEST(C&);
|
||||
TEST(C const&);
|
||||
|
||||
TEST(W const);
|
||||
TEST(W&);
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
|
||||
TEST(B&&);
|
||||
@@ -156,6 +167,8 @@ int main()
|
||||
TEST(C*);
|
||||
TEST(C const* volatile*);
|
||||
|
||||
TEST(W volatile*);
|
||||
|
||||
TEST(void*);
|
||||
TEST(void const* volatile*);
|
||||
|
||||
@@ -307,6 +320,8 @@ int main()
|
||||
|
||||
TEST(std::pair<C, C>);
|
||||
|
||||
TEST(std::pair<W, W>);
|
||||
|
||||
TEST(std::pair<void, void>);
|
||||
TEST(std::pair<std::pair<void, void>, void>);
|
||||
|
||||
@@ -336,9 +351,11 @@ int main()
|
||||
TEST(X<A const&, B&> volatile&);
|
||||
|
||||
TEST(X<C, C>);
|
||||
TEST(X<W, W>);
|
||||
|
||||
TEST(Y<A, B>);
|
||||
TEST(Y<C, C>);
|
||||
TEST(Y<W, W>);
|
||||
|
||||
TEST(X<std::pair<void, void>, void>);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user