Skip to content

Commit d8e4a84

Browse files
committed
Added unit test to verify that using error objects of pointer types results in a diagnostic
1 parent d04ff3e commit d8e4a84

File tree

4 files changed

+42
-22
lines changed

4 files changed

+42
-22
lines changed

.github/workflows/ci.yml

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,34 +19,34 @@ jobs:
1919
include:
2020
- toolset: gcc-5
2121
cxxstd: "11,14,1z"
22-
os: ubuntu-latest
2322
container: ubuntu:18.04
23+
os: ubuntu-latest
2424
install: g++-5
2525
- toolset: gcc-6
2626
cxxstd: "11,14,1z"
27-
os: ubuntu-latest
2827
container: ubuntu:18.04
28+
os: ubuntu-latest
2929
install: g++-6
3030
- toolset: gcc-7
3131
cxxstd: "11,14"
32-
os: ubuntu-latest
3332
container: ubuntu:18.04
33+
os: ubuntu-latest
3434
- toolset: gcc-8
3535
cxxstd: "11,14,17,2a"
36-
os: ubuntu-latest
3736
container: ubuntu:20.04
37+
os: ubuntu-latest
3838
install: g++-8
3939
- toolset: gcc-9
4040
cxxstd: "11,14,17,2a"
41-
os: ubuntu-latest
4241
container: ubuntu:20.04
42+
os: ubuntu-latest
4343
- toolset: gcc-10
4444
cxxstd: "11,14,17,2a"
45-
os: ubuntu-latest
4645
container: ubuntu:20.04
46+
os: ubuntu-latest
4747
install: g++-10
4848
- toolset: gcc-11
49-
cxxstd: "11,14,17,20"
49+
cxxstd: "11,14,17,2a"
5050
os: ubuntu-22.04
5151
- toolset: gcc-12
5252
cxxstd: "11,14,17,20,2b"
@@ -62,6 +62,11 @@ jobs:
6262
os: ubuntu-latest
6363
container: ubuntu:24.04
6464
install: g++-14
65+
- toolset: gcc-15
66+
cxxstd: "11,14,17,20,23,2c"
67+
os: ubuntu-latest
68+
container: ubuntu:25.04
69+
install: g++-15
6570
- toolset: clang
6671
compiler: clang++-3.9
6772
cxxstd: "11,14"
@@ -83,44 +88,44 @@ jobs:
8388
- toolset: clang
8489
compiler: clang++-6.0
8590
cxxstd: "11,14,17"
86-
os: ubuntu-latest
8791
container: ubuntu:20.04
92+
os: ubuntu-latest
8893
install: clang-6.0
8994
- toolset: clang
9095
compiler: clang++-7
9196
cxxstd: "11,14,17"
92-
os: ubuntu-latest
9397
container: ubuntu:20.04
98+
os: ubuntu-latest
9499
install: clang-7
95100
- toolset: clang
96101
compiler: clang++-8
97102
cxxstd: "11,14,17"
98-
os: ubuntu-latest
99103
container: ubuntu:20.04
104+
os: ubuntu-latest
100105
install: clang-8
101106
- toolset: clang
102107
compiler: clang++-9
103108
cxxstd: "11,14,17"
104-
os: ubuntu-latest
105109
container: ubuntu:20.04
110+
os: ubuntu-latest
106111
install: clang-9
107112
- toolset: clang
108113
compiler: clang++-10
109114
cxxstd: "11,14,17,2a"
110-
os: ubuntu-latest
111115
container: ubuntu:20.04
116+
os: ubuntu-latest
112117
install: clang-10
113118
- toolset: clang
114119
compiler: clang++-11
115120
cxxstd: "11,14,17,2a"
116-
os: ubuntu-latest
117121
container: ubuntu:20.04
122+
os: ubuntu-latest
118123
install: clang-11
119124
- toolset: clang
120125
compiler: clang++-12
121126
cxxstd: "11,14,17,20"
122-
os: ubuntu-latest
123127
container: ubuntu:20.04
128+
os: ubuntu-latest
124129
install: clang-12
125130
- toolset: clang
126131
compiler: clang++-13
@@ -161,9 +166,15 @@ jobs:
161166
- toolset: clang
162167
compiler: clang++-19
163168
cxxstd: "11,14,17,20,2b"
164-
container: ubuntu:24.10
169+
container: ubuntu:24.04
165170
os: ubuntu-latest
166171
install: clang-19
172+
- toolset: clang
173+
compiler: clang++-20
174+
cxxstd: "11,14,17,20,23,2c"
175+
container: ubuntu:25.04
176+
os: ubuntu-latest
177+
install: clang-20
167178
- toolset: clang
168179
cxxstd: "11,14,17,20,2b"
169180
os: macos-13
@@ -250,10 +261,6 @@ jobs:
250261
fail-fast: false
251262
matrix:
252263
include:
253-
- toolset: msvc-14.2
254-
cxxstd: "14,17,20,latest"
255-
addrmd: 32,64
256-
os: windows-2019
257264
- toolset: msvc-14.3
258265
cxxstd: "14,17,20,latest"
259266
addrmd: 32,64
@@ -265,7 +272,7 @@ jobs:
265272
- toolset: gcc
266273
cxxstd: "11,14,17,2a"
267274
addrmd: 64
268-
os: windows-2019
275+
os: windows-2022
269276

270277
runs-on: ${{matrix.os}}
271278

test/Jamfile.v2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ compile-fail _compile-fail-BOOST_LEAF_AUTO.cpp ;
145145
compile-fail _compile-fail-diagnostic_details.cpp ;
146146
compile-fail _compile-fail-diagnostic_info.cpp ;
147147
compile-fail _compile-fail-error_info.cpp ;
148+
compile-fail _compile-fail-error_obj_ptr.cpp ;
148149
compile-fail _compile-fail-exception_1.cpp ;
149150
compile-fail _compile-fail-exception_2.cpp ;
150151
compile-fail _compile-fail-new_error.cpp ;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright 2018-2024 Emil Dotchevski and Reverge Studios, Inc.
2+
// Distributed under the Boost Software License, Version 1.0. (See accompanying
3+
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4+
5+
#include <boost/leaf/handle_errors.hpp>
6+
7+
namespace leaf = boost::leaf;
8+
9+
void f()
10+
{
11+
int x;
12+
(void) leaf::new_error(&x);
13+
}

test/diagnostics_test4.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ struct my_error
4040
leaf::result<void> f1()
4141
{
4242
auto ctx_ = leaf::on_error([](my_error & e) {e.append(42);});
43-
return leaf::new_error("new_error");
43+
return leaf::new_error();
4444
}
4545

4646
leaf::result<void> f2()
@@ -64,7 +64,6 @@ int main()
6464
std::cout << s << std::endl;
6565
if( BOOST_LEAF_CFG_DIAGNOSTICS && BOOST_LEAF_CFG_CAPTURE )
6666
{
67-
BOOST_TEST_NE(s.find("new_error"), s.npos);
6867
BOOST_TEST_NE(s.find("appended: 42"), s.npos);
6968
BOOST_TEST_NE(s.find("appended: 43"), s.npos);
7069
}

0 commit comments

Comments
 (0)