Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to suppress MVSC warn of narrowing #2230

Merged
merged 4 commits into from
Apr 13, 2021
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion test/format-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,10 @@ TEST(FormatterTest, SpaceSign) {

TEST(FormatterTest, SignNotTruncated) {
wchar_t format_str[] = {L'{', L':',
'+' | (1 << fmt::detail::num_bits<char>()), L'}', 0};
'+' | static_cast<wchar_t>(
1 << fmt::detail::num_bits<char>()
& static_cast<typename std::make_unsigned<int>::type >(-1) ),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The second static cast and & are not needed, please remove.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May I ask if it's unneccessary always or just in this case?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see why it was added in the first place here. It has no effect.

L'}', 0};
EXPECT_THROW(format(format_str, 42), format_error);
}

Expand Down