Skip to content

Commit b7a2bea

Browse files
Ignore warning
1 parent b4823de commit b7a2bea

1 file changed

Lines changed: 8 additions & 20 deletions

File tree

tests/channel_test.cpp

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -382,31 +382,19 @@ TEST(ChannelTest, Transform)
382382

383383
// Transform input channel values from movable_only to int by multiplying by 2 and write to output channel
384384
const auto double_transformer = [&input_chan, &output_chan]() {
385-
const auto double_value = [](auto&& value) { return value.getValue() * 2; };
386385
#ifdef _MSC_VER
387-
for (auto&& value : input_chan) {
388-
output_chan.write(double_value(value));
389-
}
386+
#pragma warning(push)
387+
#pragma warning(disable : 4702)
388+
#endif
389+
const auto double_value = [](auto&& value) { return value.getValue() * 2; };
390390

391-
// Does not work with std::transform
392-
// -- Building for: Visual Studio 17 2022
393-
// -- The C compiler identification is MSVC 19.43.34808.0
394-
// -- The CXX compiler identification is MSVC 19.43.34808.0
395-
//
396-
// Release: does not compile - warning C4702: unreachable code
397-
// Debug: compiles, but copies the movable_only object instead of moving it
398-
//
399-
// Posibilities:
400-
// - I am doing something very wrong (see operator* in blocking_writer_iterator)
401-
// - MSVC has a bug
402-
// - https://github.com/ericniebler/range-v3/issues/1814
403-
// - https://github.com/ericniebler/range-v3/issues/1762
404-
// - Other compilers are more permissive
405-
#else
406391
std::transform(input_chan.begin(), input_chan.end(), msd::back_inserter(output_chan), double_value);
407-
#endif // _MSC_VER
408392

409393
output_chan.close();
394+
395+
#ifdef _MSC_VER
396+
#pragma warning(pop)
397+
#endif
410398
};
411399

412400
// Read from output channel

0 commit comments

Comments
 (0)