Skip to content

Commit

Permalink
Add test/bit_width_fail (refs #129)
Browse files Browse the repository at this point in the history
  • Loading branch information
pdimov committed Sep 21, 2022
1 parent 3510f62 commit 2cc3e23
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions test/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,9 @@ run bit_popcount_test.cpp
run bit_endian_test.cpp
: : : $(pedantic-errors) ;

compile-fail bit_width_fail.cpp
: <warnings>off ;

run type_name_test.cpp ;

run sv_types_test.cpp ;
Expand Down
13 changes: 13 additions & 0 deletions test/bit_width_fail.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Negative test for boost/core/bit.hpp (bit_width)
//
// Copyright 2022 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt

#include <boost/core/bit.hpp>

int main()
{
// should fail, because 0 is a signed integral type
return boost::core::bit_width( 0 );
}

0 comments on commit 2cc3e23

Please sign in to comment.