Skip to content

Commit

Permalink
[FIX] libc++: fmtflags = unsigned
Browse files Browse the repository at this point in the history
  • Loading branch information
eseiler committed Nov 12, 2023
1 parent 4dac85c commit 6948b70
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/seqan3/core/debug_stream/debug_stream_type.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,17 @@ class debug_stream_type
stream->unsetf(flag);
}

// fmtflags are an enum in libstc++ and unsigned in libc++
#ifdef _LIBCPP_VERSION
static_assert(std::same_as<fmtflags, unsigned>);
#else
//!\copybrief setf()
debug_stream_type & operator<<(fmtflags const flag)
{
setf(flag);
return *this;
}
#endif
//!\}

/*!\name Format flags (seqan3::fmtflags2)
Expand Down
11 changes: 11 additions & 0 deletions test/unit/core/debug_stream_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,3 +286,14 @@ TEST(debug_stream_test, byte)
o.flush();
EXPECT_EQ(o.str(), "40,244");
}

TEST(debug_stream_test, integers)
{
std::ostringstream o{};
seqan3::debug_stream_type my_stream{o};

my_stream << uint8_t{1} << ',' << uint16_t{2} << ',' << uint32_t{3} << ',' << uint64_t{4} << ',' << size_t{5} << ','
<< int8_t{6} << ',' << int16_t{7} << ',' << int32_t{8} << ',' << int64_t{9};
o.flush();
EXPECT_EQ(o.str(), "1,2,3,4,5,6,7,8,9");
}

0 comments on commit 6948b70

Please sign in to comment.