Opened 13 years ago
Closed 13 years ago
#3583 closed Bugs (fixed)
iterator in fusion::detail::segmented_range not adjusted after copying
Reported by: | Christopher Schmidt | Owned by: | Eric Niebler |
---|---|---|---|
Milestone: | Boost 1.42.0 | Component: | proto |
Version: | Boost Development Trunk | Severity: | Problem |
Keywords: | Cc: | Christopher Schmidt |
Description
Consider the following code:
boost::fusion::begin(boost::proto::flatten(a_ >> b_))
with a_ and b_ being two proto terminals.
Internally this will yield to a local instantiation of fusion::detail::segmented_range<boost::fusion::single_view<boost::proto::exprns_::expr<...> > >. This segmented range view is copied in a fusion::cons, and this cons is returned to the caller segmented_iterator.hpp#L272
The iterator (segmented_range::where_) on the single view (segmented_range::sequence) is not adjusted when being copyed. Therefore the where_ attribute of the segmented_range in the cons points to an already destructed single view after the cons is returned to the caller. At the moment this is not much of a problem as single view iterators store a copy of the value of the actual single_view they point to (single_view_iterator.hpp). With the upcoming c++0x port of fusion this behaviour will change though. Single view iterators will store a pointer to the actual single view instead.
Attachments (1)
Change History (4)
comment:1 by , 13 years ago
comment:2 by , 13 years ago
Apply the attached patch to a local copy of the TRUNK and run the proto "fusion.cpp" testcase.
That's the output on my machine (gcc 4.4.1, MinGW)
BEGIN OUTPUT
Running 1 test case... libs/proto/test/proto_fusion.cpp(93): error in "test1": check "(a>>b)(c>>d)" == sout.str() failed [(a>>b)(c>>d) != (ÿ>>ð)(c>>d)]
* 1 failure detected in test suite "Master Test Suite" EXIT STATUS: 201
END OUTPUT
by , 13 years ago
Attachment: | fusion.diff added |
---|
comment:3 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Please either tell me how to reproduce the error or submit a patch. I don't really understand the problem based just on your description. Thanks.