2
0
mirror of https://github.com/boostorg/leaf.git synced 2026-01-19 04:22:08 +00:00

Added unit test to verify that using error objects of pointer types results in a diagnostic

This commit is contained in:
Emil Dotchevski
2025-10-13 12:35:38 -04:00
parent d04ff3e44f
commit d8e4a84080
4 changed files with 42 additions and 22 deletions

View File

@@ -19,34 +19,34 @@ jobs:
include:
- toolset: gcc-5
cxxstd: "11,14,1z"
os: ubuntu-latest
container: ubuntu:18.04
os: ubuntu-latest
install: g++-5
- toolset: gcc-6
cxxstd: "11,14,1z"
os: ubuntu-latest
container: ubuntu:18.04
os: ubuntu-latest
install: g++-6
- toolset: gcc-7
cxxstd: "11,14"
os: ubuntu-latest
container: ubuntu:18.04
os: ubuntu-latest
- toolset: gcc-8
cxxstd: "11,14,17,2a"
os: ubuntu-latest
container: ubuntu:20.04
os: ubuntu-latest
install: g++-8
- toolset: gcc-9
cxxstd: "11,14,17,2a"
os: ubuntu-latest
container: ubuntu:20.04
os: ubuntu-latest
- toolset: gcc-10
cxxstd: "11,14,17,2a"
os: ubuntu-latest
container: ubuntu:20.04
os: ubuntu-latest
install: g++-10
- toolset: gcc-11
cxxstd: "11,14,17,20"
cxxstd: "11,14,17,2a"
os: ubuntu-22.04
- toolset: gcc-12
cxxstd: "11,14,17,20,2b"
@@ -62,6 +62,11 @@ jobs:
os: ubuntu-latest
container: ubuntu:24.04
install: g++-14
- toolset: gcc-15
cxxstd: "11,14,17,20,23,2c"
os: ubuntu-latest
container: ubuntu:25.04
install: g++-15
- toolset: clang
compiler: clang++-3.9
cxxstd: "11,14"
@@ -83,44 +88,44 @@ jobs:
- toolset: clang
compiler: clang++-6.0
cxxstd: "11,14,17"
os: ubuntu-latest
container: ubuntu:20.04
os: ubuntu-latest
install: clang-6.0
- toolset: clang
compiler: clang++-7
cxxstd: "11,14,17"
os: ubuntu-latest
container: ubuntu:20.04
os: ubuntu-latest
install: clang-7
- toolset: clang
compiler: clang++-8
cxxstd: "11,14,17"
os: ubuntu-latest
container: ubuntu:20.04
os: ubuntu-latest
install: clang-8
- toolset: clang
compiler: clang++-9
cxxstd: "11,14,17"
os: ubuntu-latest
container: ubuntu:20.04
os: ubuntu-latest
install: clang-9
- toolset: clang
compiler: clang++-10
cxxstd: "11,14,17,2a"
os: ubuntu-latest
container: ubuntu:20.04
os: ubuntu-latest
install: clang-10
- toolset: clang
compiler: clang++-11
cxxstd: "11,14,17,2a"
os: ubuntu-latest
container: ubuntu:20.04
os: ubuntu-latest
install: clang-11
- toolset: clang
compiler: clang++-12
cxxstd: "11,14,17,20"
os: ubuntu-latest
container: ubuntu:20.04
os: ubuntu-latest
install: clang-12
- toolset: clang
compiler: clang++-13
@@ -161,9 +166,15 @@ jobs:
- toolset: clang
compiler: clang++-19
cxxstd: "11,14,17,20,2b"
container: ubuntu:24.10
container: ubuntu:24.04
os: ubuntu-latest
install: clang-19
- toolset: clang
compiler: clang++-20
cxxstd: "11,14,17,20,23,2c"
container: ubuntu:25.04
os: ubuntu-latest
install: clang-20
- toolset: clang
cxxstd: "11,14,17,20,2b"
os: macos-13
@@ -250,10 +261,6 @@ jobs:
fail-fast: false
matrix:
include:
- toolset: msvc-14.2
cxxstd: "14,17,20,latest"
addrmd: 32,64
os: windows-2019
- toolset: msvc-14.3
cxxstd: "14,17,20,latest"
addrmd: 32,64
@@ -265,7 +272,7 @@ jobs:
- toolset: gcc
cxxstd: "11,14,17,2a"
addrmd: 64
os: windows-2019
os: windows-2022
runs-on: ${{matrix.os}}

View File

@@ -145,6 +145,7 @@ compile-fail _compile-fail-BOOST_LEAF_AUTO.cpp ;
compile-fail _compile-fail-diagnostic_details.cpp ;
compile-fail _compile-fail-diagnostic_info.cpp ;
compile-fail _compile-fail-error_info.cpp ;
compile-fail _compile-fail-error_obj_ptr.cpp ;
compile-fail _compile-fail-exception_1.cpp ;
compile-fail _compile-fail-exception_2.cpp ;
compile-fail _compile-fail-new_error.cpp ;

View File

@@ -0,0 +1,13 @@
// Copyright 2018-2024 Emil Dotchevski and Reverge Studios, Inc.
// 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 <boost/leaf/handle_errors.hpp>
namespace leaf = boost::leaf;
void f()
{
int x;
(void) leaf::new_error(&x);
}

View File

@@ -40,7 +40,7 @@ struct my_error
leaf::result<void> f1()
{
auto ctx_ = leaf::on_error([](my_error & e) {e.append(42);});
return leaf::new_error("new_error");
return leaf::new_error();
}
leaf::result<void> f2()
@@ -64,7 +64,6 @@ int main()
std::cout << s << std::endl;
if( BOOST_LEAF_CFG_DIAGNOSTICS && BOOST_LEAF_CFG_CAPTURE )
{
BOOST_TEST_NE(s.find("new_error"), s.npos);
BOOST_TEST_NE(s.find("appended: 42"), s.npos);
BOOST_TEST_NE(s.find("appended: 43"), s.npos);
}