Skip to content

Commit af978cf

Browse files
committed
Add assert_is_void_test2.cpp
1 parent d82647a commit af978cf

2 files changed

Lines changed: 38 additions & 0 deletions

File tree

test/Jamfile.v2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,4 @@ run source_location_test6.cpp ;
4848

4949
run assert_test3.cpp ;
5050
run assert_test4.cpp ;
51+
run assert_is_void_test2.cpp ;

test/assert_is_void_test2.cpp

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Copyright 2015 Ion Gaztanaga
2+
// Copyright 2026 Peter Dimov
3+
// Distributed under the Boost Software License, Version 1.0.
4+
// https://www.boost.org/LICENSE_1_0.txt
5+
6+
// BOOST_ENABLE_ASSERT_HANDLER, BOOST_ENABLE_ASSERT_DEBUG_HANDLER
7+
8+
#define BOOST_ENABLE_ASSERT_HANDLER
9+
#define BOOST_ENABLE_ASSERT_DEBUG_HANDLER
10+
#include <boost/assert.hpp>
11+
12+
#if defined(NDEBUG)
13+
14+
#ifndef BOOST_ASSERT_IS_VOID
15+
#error "BOOST_ASSERT should be void if BOOST_ENABLE_ASSERT_HANDLER, BOOST_ENABLE_ASSERT_DEBUG_HANDLER, and NDEBUG are defined"
16+
#endif
17+
18+
#else
19+
20+
#ifdef BOOST_ASSERT_IS_VOID
21+
#error "BOOST_ASSERT should NOT be void if BOOST_ENABLE_ASSERT_HANDLER and BOOST_ENABLE_ASSERT_DEBUG_HANDLER are defined, but NDEBUG is not"
22+
#endif
23+
24+
#endif
25+
26+
// +BOOST_DISABLE_ASSERTS
27+
28+
#define BOOST_DISABLE_ASSERTS
29+
#include <boost/assert.hpp>
30+
31+
#ifndef BOOST_ASSERT_IS_VOID
32+
#error "Error: BOOST_ASSERT should always be void with BOOST_DISABLE_ASSERTS"
33+
#endif
34+
35+
int main()
36+
{
37+
}

0 commit comments

Comments
 (0)