mirror of
https://github.com/boostorg/core.git
synced 2025-07-29 20:37:22 +02:00
Sync from upstream.
This commit is contained in:
@ -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(
|
||||
|
25
.github/workflows/ci.yml
vendored
25
.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
|
||||
|
@ -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<class T>
|
||||
@ -138,10 +140,10 @@ 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> base;
|
||||
typedef detail::empty_value_base<T> 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<class U, class... Args>
|
||||
BOOST_CONSTEXPR empty_value(boost::empty_init_t, U&& value, Args&&... args)
|
||||
: base(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)
|
||||
: base(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)
|
||||
: base(value) { }
|
||||
: empty_base_(value) { }
|
||||
|
||||
template<class U>
|
||||
BOOST_CONSTEXPR empty_value(boost::empty_init_t, U& value)
|
||||
: base(value) { }
|
||||
: empty_base_(value) { }
|
||||
#endif
|
||||
|
||||
BOOST_CONSTEXPR const T& get() const BOOST_NOEXCEPT {
|
||||
|
@ -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 ;
|
||||
|
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;
|
||||
}
|
@ -63,40 +63,6 @@ void test_type()
|
||||
BOOST_TEST(v2.get().value() == 6);
|
||||
}
|
||||
|
||||
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_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<outer> x1(boost::empty_init);
|
||||
const boost::empty_value<outer::inner_empty> x2(boost::empty_init);
|
||||
const boost::empty_value<outer::inner_non_empty> x3(boost::empty_init);
|
||||
const derived<outer> x4(boost::empty_init);
|
||||
const derived<outer::inner_empty> x5(boost::empty_init);
|
||||
const derived<outer::inner_non_empty> x6(boost::empty_init);
|
||||
|
||||
(void)x1;
|
||||
(void)x2;
|
||||
(void)x3;
|
||||
(void)x4;
|
||||
(void)x5;
|
||||
(void)x6;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test_int();
|
||||
|
Reference in New Issue
Block a user