Skip to content

Commit 4c592db

Browse files
Document issue
1 parent ddc963e commit 4c592db

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

include/msd/blocking_iterator.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,12 @@ class blocking_writer_iterator {
150150
/**
151151
* @brief Not applicable (handled by operator=).
152152
*
153+
* @note It's uncommon to return a reference to an iterator, but I don't want to return a value from the channel.
154+
* This iterator is supposed to be used only to write values.
155+
* I don't know if it's a terrible idea or not, but it looks related to the issue with MSVC
156+
* in the Transform test in tests/channel_test.cpp.
157+
*
158+
*
153159
* @return The iterator itself.
154160
*/
155161
blocking_writer_iterator& operator*() { return *this; }

tests/channel_test.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,10 +388,18 @@ TEST(ChannelTest, Transform)
388388
output_chan.write(double_value(value));
389389
}
390390

391-
// Does not work with std::transform: warning C4702: unreachable code
391+
// Does not work with std::transform
392392
// -- Building for: Visual Studio 17 2022
393393
// -- The C compiler identification is MSVC 19.43.34808.0
394394
// -- 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+
// - Other compilers are more permissive
395403
#else
396404
std::transform(input_chan.begin(), input_chan.end(), msd::back_inserter(output_chan), double_value);
397405
#endif // _MSC_VER

0 commit comments

Comments
 (0)