Opened 5 years ago

Closed 4 years ago

#9801 closed Bugs (fixed)

I can no longer create and iterator_range from a stable_vector

Reported by: Joseph Southwell <joseph@…> Owned by: Ion Gaztañaga
Milestone: Boost 1.56.0 Component: container
Version: Boost Release Branch Severity: Regression
Keywords: Cc:

Description

modular boost master
boost range at fa629a53bd7bcbd8a09520c5f5b016cd8647de18
boost container at 7ca156661fb1b8455362f639975459f0825ea75c
Visual Studio 2013
#include <boost/container/stable_vector.hpp>
#include <boost/range/iterator_range.hpp>

typedef boost::container::stable_vector<int> stack_type;
typedef boost::iterator_range<stack_type::iterator> stack_range;

int _tmain(int argc, _TCHAR* argv[])
{
   stack_type stack;
   stack_range(stack.begin(), stack.end());
        return 0;
}
1>  ConsoleApplication6.cpp
1>c:\development\modular-boost\boost\range\mutable_iterator.hpp(35): error C2146: syntax error : missing ';' before identifier 'type'
1>          c:\development\modular-boost\boost\range\mutable_iterator.hpp(42) : see reference to class template instantiation 'boost::range_detail::extract_iterator<boost::container::stable_vector_detail::iterator<int *,false>,void>' being compiled
1>          c:\development\modular-boost\boost\range\has_range_iterator.hpp(27) : see reference to class template instantiation 'boost::range_mutable_iterator<boost::container::stable_vector_detail::iterator<int *,false>>' being compiled
1>          c:\development\modular-boost\boost\mpl\eval_if.hpp(41) : see reference to class template instantiation 'boost::range_detail::has_type<boost::range_mutable_iterator<boost::container::stable_vector_detail::iterator<int *,false>>,boost::mpl::bool_<false>>' being compiled
1>          c:\development\modular-boost\boost\range\has_range_iterator.hpp(73) : see reference to class template instantiation 'boost::mpl::eval_if<boost::is_const<boost::container::stable_vector_detail::iterator<int *,false>>,boost::range_detail::has_type<boost::range_detail::range_const_iterator<boost::container::stable_vector_detail::iterator<int *,false>>,boost::mpl::bool_<false>>,boost::range_detail::has_type<boost::range_mutable_iterator<boost::container::stable_vector_detail::iterator<int *,false>>,boost::mpl::bool_<false>>>' being compiled
1>          c:\development\modular-boost\boost\mpl\if.hpp(63) : see reference to class template instantiation 'boost::has_range_iterator<Source>' being compiled
1>          with
1>          [
1>              Source=boost::container::stable_vector_detail::iterator<int *,false>
1>          ]
1>          c:\development\modular-boost\boost\mpl\eval_if.hpp(40) : see reference to class template instantiation 'boost::mpl::if_<C,F1,F2>' being compiled
1>          with
1>          [
1>              C=boost::has_range_iterator<boost::container::stable_vector_detail::iterator<int *,false>>
1>  ,            F1=boost::range_iterator<boost::container::stable_vector_detail::iterator<int *,false>>
1>  ,            F2=boost::mpl::identity<void>
1>          ]
1>          c:\development\modular-boost\boost\range\iterator_range_core.hpp(400) : see reference to class template instantiation 'boost::mpl::eval_if<boost::has_range_iterator<Source>,boost::range_iterator<Source>,boost::mpl::identity<void>>' being compiled
1>          with
1>          [
1>              Source=boost::container::stable_vector_detail::iterator<int *,false>
1>          ]
1>          c:\development\modular-boost\boost\utility\enable_if.hpp(36) : see reference to class template instantiation 'boost::iterator_range<boost::container::stable_vector_detail::iterator<int *,false>>::is_compatible_range<boost::container::stable_vector_detail::iterator<int *,false>>' being compiled
1>          c:\users\jsouthwell\documents\visual studio 2013\projects\consoleapplication6\consoleapplication6\consoleapplication6.cpp(15) : see reference to class template instantiation 'boost::enable_if<boost::iterator_range<boost::container::stable_vector_detail::iterator<int *,false>>::is_compatible_range<boost::container::stable_vector_detail::iterator<int *,false>>,void>' being compiled
1>c:\development\modular-boost\boost\range\mutable_iterator.hpp(35): error C3254: 'boost::range_detail::extract_iterator<boost::container::stable_vector_detail::iterator<int *,false>,void>' : class contains explicit override '{ctor}' but does not derive from an interface that contains the function declaration
1>c:\development\modular-boost\boost\range\mutable_iterator.hpp(35): error C2838: '{ctor}' : illegal qualified name in member declaration
1>c:\development\modular-boost\boost\range\mutable_iterator.hpp(35): error C2461: 'boost::range_detail::extract_iterator<boost::container::stable_vector_detail::iterator<int *,false>,void>' : constructor syntax missing formal parameters
1>c:\development\modular-boost\boost\range\mutable_iterator.hpp(35): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

Attachments (2)

ConsoleApplication6.7z (2.5 KB) - added by Joseph Southwell <joseph@…> 5 years ago.
file.patch (12.1 KB) - added by Joseph Southwell <joseph@…> 4 years ago.
patch file to work around the problem in the stable_vector_detail namespace

Download all attachments as: .zip

Change History (11)

comment:1 Changed 5 years ago by Joseph Southwell <joseph@…>

Appears to have been caused by libs/range checkin 8b60f2c768521226bf9fe0bb6edcd0e2919f2702 iterator_range interop with variant.

comment:2 Changed 5 years ago by Neil Groves

Status: newassigned

I've compiled your example with both develop and master branches without error using GCC 4.8.2 on Ubuntu 14.04.

Can you please let me know if you can still reproduce the issue? If you can I'll configure a Windows machine and sort this out.

Changed 5 years ago by Joseph Southwell <joseph@…>

Attachment: ConsoleApplication6.7z added

comment:3 Changed 5 years ago by Joseph Southwell <joseph@…>

Yes, same problem. Visual Studio 2013 with Update 2 RC. I attached the project file if that helps. I will test on my mac and let if that is working.

comment:4 Changed 5 years ago by Joseph Southwell <joseph@…>

I did git pull on all submodules before testing.

comment:5 Changed 5 years ago by Joseph Southwell <joseph@…>

It compiles on CLANG just fine.

comment:6 Changed 4 years ago by Neil Groves

Milestone: To Be DeterminedBoost 1.56.0

I am really pleased that you have attached the project. I'll get my Windows box ready to compile this in a wee bit. I'll try to get this in with my other 1.56 changes.

comment:7 Changed 4 years ago by Neil Groves

Component: rangecontainer
Owner: changed from Neil Groves to Ion Gaztañaga
Status: assignednew

I have been able to reproduce the problem. This is a compiler defect that has plagued Microsoft C++ compilers for many major versions. It simply reaches a scalability point where the names become jumbled and muddled between namespaces. It is almost impossible to reproduce a small test case and therefore very difficult to get Microsoft to take the report seriously.

The reason that only stable_vector appears to be a problem is that it, quite legitimately uses the class name iterator within the boost::stable_vector_detail namespace. However the Microsoft compiler is confusing the class in boost::stable_vector_detail::iterator with the iterator typedef within stable_vector. I have proven this to be true by renaming boost::stable_vector_detail::iterator to boost::stable_vector_detail::sv_iterator and showing that this fixes the issue.

It is therefore clearly neither a defect in Boost.Container or Boost.Range, but try as I might there appears to only be the possibilty to work-around this problem by making a small change to Boost.Container.

I am therefore reassigning this defect to Boost.Container since I do not have write-access to fix this problem myself. It is clear that simply renaming iterator to sv_iterator fixes this issue.

Changed 4 years ago by Joseph Southwell <joseph@…>

Attachment: file.patch added

patch file to work around the problem in the stable_vector_detail namespace

comment:8 Changed 4 years ago by Joseph Southwell <joseph@…>

I can concur that the suggested work around works. I can also concur about visual c++, unfortunately I am locked in so if you could incorporate this work around so I don't have maintain my own version of stable_vector I would appreciate it.

comment:9 Changed 4 years ago by Ion Gaztañaga

Resolution: fixed
Status: newclosed

Thanks for the patch. Modified and fixed also the test in:

[develop 790a879] Fixes Trac issue #9801 ("I can no longer create and iterator_range from a stable_vector")

3 files changed, 130 insertions(+), 137 deletions(-)

Note: See TracTickets for help on using tickets.