Boost C++ Libraries: Ticket #9801: I can no longer create and iterator_range from a stable_vector https://svn.boost.org/trac10/ticket/9801 <pre class="wiki">modular boost master boost range at fa629a53bd7bcbd8a09520c5f5b016cd8647de18 boost container at 7ca156661fb1b8455362f639975459f0825ea75c Visual Studio 2013 </pre><div class="wiki-code"><div class="code"><pre><span class="cp">#include</span> <span class="cpf">&lt;boost/container/stable_vector.hpp&gt;</span><span class="cp"></span> <span class="cp">#include</span> <span class="cpf">&lt;boost/range/iterator_range.hpp&gt;</span><span class="cp"></span> <span class="k">typedef</span> <span class="n">boost</span><span class="o">::</span><span class="n">container</span><span class="o">::</span><span class="n">stable_vector</span><span class="o">&lt;</span><span class="kt">int</span><span class="o">&gt;</span> <span class="n">stack_type</span><span class="p">;</span> <span class="k">typedef</span> <span class="n">boost</span><span class="o">::</span><span class="n">iterator_range</span><span class="o">&lt;</span><span class="n">stack_type</span><span class="o">::</span><span class="n">iterator</span><span class="o">&gt;</span> <span class="n">stack_range</span><span class="p">;</span> <span class="kt">int</span> <span class="nf">_tmain</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="n">_TCHAR</span><span class="o">*</span> <span class="n">argv</span><span class="p">[])</span> <span class="p">{</span> <span class="n">stack_type</span> <span class="n">stack</span><span class="p">;</span> <span class="n">stack_range</span><span class="p">(</span><span class="n">stack</span><span class="p">.</span><span class="n">begin</span><span class="p">(),</span> <span class="n">stack</span><span class="p">.</span><span class="n">end</span><span class="p">());</span> <span class="k">return</span> <span class="mi">0</span><span class="p">;</span> <span class="p">}</span> </pre></div></div><pre class="wiki">1&gt; ConsoleApplication6.cpp 1&gt;c:\development\modular-boost\boost\range\mutable_iterator.hpp(35): error C2146: syntax error : missing ';' before identifier 'type' 1&gt; c:\development\modular-boost\boost\range\mutable_iterator.hpp(42) : see reference to class template instantiation 'boost::range_detail::extract_iterator&lt;boost::container::stable_vector_detail::iterator&lt;int *,false&gt;,void&gt;' being compiled 1&gt; c:\development\modular-boost\boost\range\has_range_iterator.hpp(27) : see reference to class template instantiation 'boost::range_mutable_iterator&lt;boost::container::stable_vector_detail::iterator&lt;int *,false&gt;&gt;' being compiled 1&gt; c:\development\modular-boost\boost\mpl\eval_if.hpp(41) : see reference to class template instantiation 'boost::range_detail::has_type&lt;boost::range_mutable_iterator&lt;boost::container::stable_vector_detail::iterator&lt;int *,false&gt;&gt;,boost::mpl::bool_&lt;false&gt;&gt;' being compiled 1&gt; c:\development\modular-boost\boost\range\has_range_iterator.hpp(73) : see reference to class template instantiation 'boost::mpl::eval_if&lt;boost::is_const&lt;boost::container::stable_vector_detail::iterator&lt;int *,false&gt;&gt;,boost::range_detail::has_type&lt;boost::range_detail::range_const_iterator&lt;boost::container::stable_vector_detail::iterator&lt;int *,false&gt;&gt;,boost::mpl::bool_&lt;false&gt;&gt;,boost::range_detail::has_type&lt;boost::range_mutable_iterator&lt;boost::container::stable_vector_detail::iterator&lt;int *,false&gt;&gt;,boost::mpl::bool_&lt;false&gt;&gt;&gt;' being compiled 1&gt; c:\development\modular-boost\boost\mpl\if.hpp(63) : see reference to class template instantiation 'boost::has_range_iterator&lt;Source&gt;' being compiled 1&gt; with 1&gt; [ 1&gt; Source=boost::container::stable_vector_detail::iterator&lt;int *,false&gt; 1&gt; ] 1&gt; c:\development\modular-boost\boost\mpl\eval_if.hpp(40) : see reference to class template instantiation 'boost::mpl::if_&lt;C,F1,F2&gt;' being compiled 1&gt; with 1&gt; [ 1&gt; C=boost::has_range_iterator&lt;boost::container::stable_vector_detail::iterator&lt;int *,false&gt;&gt; 1&gt; , F1=boost::range_iterator&lt;boost::container::stable_vector_detail::iterator&lt;int *,false&gt;&gt; 1&gt; , F2=boost::mpl::identity&lt;void&gt; 1&gt; ] 1&gt; c:\development\modular-boost\boost\range\iterator_range_core.hpp(400) : see reference to class template instantiation 'boost::mpl::eval_if&lt;boost::has_range_iterator&lt;Source&gt;,boost::range_iterator&lt;Source&gt;,boost::mpl::identity&lt;void&gt;&gt;' being compiled 1&gt; with 1&gt; [ 1&gt; Source=boost::container::stable_vector_detail::iterator&lt;int *,false&gt; 1&gt; ] 1&gt; c:\development\modular-boost\boost\utility\enable_if.hpp(36) : see reference to class template instantiation 'boost::iterator_range&lt;boost::container::stable_vector_detail::iterator&lt;int *,false&gt;&gt;::is_compatible_range&lt;boost::container::stable_vector_detail::iterator&lt;int *,false&gt;&gt;' being compiled 1&gt; c:\users\jsouthwell\documents\visual studio 2013\projects\consoleapplication6\consoleapplication6\consoleapplication6.cpp(15) : see reference to class template instantiation 'boost::enable_if&lt;boost::iterator_range&lt;boost::container::stable_vector_detail::iterator&lt;int *,false&gt;&gt;::is_compatible_range&lt;boost::container::stable_vector_detail::iterator&lt;int *,false&gt;&gt;,void&gt;' being compiled 1&gt;c:\development\modular-boost\boost\range\mutable_iterator.hpp(35): error C3254: 'boost::range_detail::extract_iterator&lt;boost::container::stable_vector_detail::iterator&lt;int *,false&gt;,void&gt;' : class contains explicit override '{ctor}' but does not derive from an interface that contains the function declaration 1&gt;c:\development\modular-boost\boost\range\mutable_iterator.hpp(35): error C2838: '{ctor}' : illegal qualified name in member declaration 1&gt;c:\development\modular-boost\boost\range\mutable_iterator.hpp(35): error C2461: 'boost::range_detail::extract_iterator&lt;boost::container::stable_vector_detail::iterator&lt;int *,false&gt;,void&gt;' : constructor syntax missing formal parameters 1&gt;c:\development\modular-boost\boost\range\mutable_iterator.hpp(35): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/9801 Trac 1.4.3 Joseph Southwell <joseph@…> Thu, 20 Mar 2014 22:11:08 GMT <link>https://svn.boost.org/trac10/ticket/9801#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9801#comment:1</guid> <description> <p> Appears to have been caused by libs/range checkin 8b60f2c768521226bf9fe0bb6edcd0e2919f2702 iterator_range interop with variant. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Neil Groves</dc:creator> <pubDate>Wed, 07 May 2014 00:03:10 GMT</pubDate> <title>status changed https://svn.boost.org/trac10/ticket/9801#comment:2 https://svn.boost.org/trac10/ticket/9801#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> <p> I've compiled your example with both develop and master branches without error using GCC 4.8.2 on Ubuntu 14.04. </p> <p> 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. </p> Ticket Joseph Southwell <joseph@…> Wed, 07 May 2014 16:11:04 GMT attachment set https://svn.boost.org/trac10/ticket/9801 https://svn.boost.org/trac10/ticket/9801 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">ConsoleApplication6.7z</span> </li> </ul> Ticket Joseph Southwell <joseph@…> Wed, 07 May 2014 16:12:05 GMT <link>https://svn.boost.org/trac10/ticket/9801#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9801#comment:3</guid> <description> <p> 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. </p> </description> <category>Ticket</category> </item> <item> <author>Joseph Southwell <joseph@…></author> <pubDate>Wed, 07 May 2014 16:12:52 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9801#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9801#comment:4</guid> <description> <p> I did git pull on all submodules before testing. </p> </description> <category>Ticket</category> </item> <item> <author>Joseph Southwell <joseph@…></author> <pubDate>Wed, 07 May 2014 19:10:42 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9801#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9801#comment:5</guid> <description> <p> It compiles on CLANG just fine. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Neil Groves</dc:creator> <pubDate>Wed, 04 Jun 2014 12:23:27 GMT</pubDate> <title>milestone changed https://svn.boost.org/trac10/ticket/9801#comment:6 https://svn.boost.org/trac10/ticket/9801#comment:6 <ul> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.56.0</span> </li> </ul> <p> 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. </p> Ticket Neil Groves Thu, 05 Jun 2014 13:07:06 GMT owner, status, component changed https://svn.boost.org/trac10/ticket/9801#comment:7 https://svn.boost.org/trac10/ticket/9801#comment:7 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Neil Groves</span> to <span class="trac-author">Ion Gaztañaga</span> </li> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">new</span> </li> <li><strong>component</strong> <span class="trac-field-old">range</span> → <span class="trac-field-new">container</span> </li> </ul> <p> 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. </p> <p> 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. </p> <p> 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. </p> <p> 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. </p> Ticket Joseph Southwell <joseph@…> Thu, 05 Jun 2014 17:30:11 GMT attachment set https://svn.boost.org/trac10/ticket/9801 https://svn.boost.org/trac10/ticket/9801 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">file.patch</span> </li> </ul> <p> patch file to work around the problem in the stable_vector_detail namespace </p> Ticket Joseph Southwell <joseph@…> Thu, 05 Jun 2014 17:33:14 GMT <link>https://svn.boost.org/trac10/ticket/9801#comment:8 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9801#comment:8</guid> <description> <p> 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. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Ion Gaztañaga</dc:creator> <pubDate>Fri, 06 Jun 2014 11:29:29 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/9801#comment:9 https://svn.boost.org/trac10/ticket/9801#comment:9 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Thanks for the patch. Modified and fixed also the test in: </p> <p> [develop 790a879] Fixes Trac issue <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/9801" title="#9801: Bugs: I can no longer create and iterator_range from a stable_vector (closed: fixed)">#9801</a> ("I can no longer create and iterator_range from a stable_vector") </p> <blockquote> <p> 3 files changed, 130 insertions(+), 137 deletions(-) </p> </blockquote> Ticket