Re: [Boost-bugs] [Boost C++ Libraries] #1315: iterator_adaptor does not work with incomplete Value types

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #1315: iterator_adaptor does not work with incomplete Value types
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2008-04-24 14:36:22


#1315: iterator_adaptor does not work with incomplete Value types
--------------------------------------+-------------------------------------
  Reporter: joaquin | Owner: dave
      Type: Feature Requests | Status: new
 Milestone: To Be Determined | Component: iterator
   Version: Boost Development Trunk | Severity: Problem
Resolution: | Keywords:
--------------------------------------+-------------------------------------
Comment (by Laurent Rineau <Laurent.Rineau__boost_at_[hidden]>):

 I encounter this bug with a code example a bit more tricky:
 {{{
 #include <boost/iterator/iterator_facade.hpp>

 template <class V>
 struct Iterator
     : public boost::iterator_facade<Iterator<V>,
                                     V,
                                     std::bidirectional_iterator_tag >
 {
   friend class boost::iterator_core_access;

   bool equal(Iterator other) const { return true; }

   V& dereference() const { V ref; return ref; }

   void increment() {}

   void decrement() {}
 };


 template < class T >
 struct Vertex_base
 {
   typedef typename T::Face_iterator Face_iterator;

   Face_iterator _f;
 };



 template < typename T>
 struct Face_base
 {
   typedef typename T::Vertex_iterator Vertex_iterator;

   Vertex_iterator V;
 };


 struct Triangulation
 {
   typedef Vertex_base<Triangulation> Vertex;
   typedef Face_base<Triangulation> Face;

   typedef Iterator<Face> Face_iterator;
   typedef Iterator<Vertex> Vertex_iterator;

   Vertex_iterator v;
 };


 int main()
 {
   Triangulation t;

   return 0;
 }
 }}}

 g++-4.1.2 and g++-4.3.0 do compile the code above, with boost-1.34.1 or
 with boost trunk (revision 44750), but MSVC++ 8.0 does not (same error
 diagnostic as the bug submitter):
 {{{
 cd c:/applis/downloads/boost_1_35_0/
 cl.exe -I. facade.cpp
 Microsoft (R) C/C++ Optimizing Compiler Version 14.00.50727.42 for x64
 Copyright (C) Microsoft Corporation.  All rights reserved.

 facade.cpp
 facade.cpp(42) : error C2148: total size of array must not exceed
 0x7fffffff bytes
 Â        .\boost/type_traits/is_class.hpp(76) : see reference to class
 template instantiation 'Face_base<T>' being compiled
 Â        with
 Â        [
 Â            T=Triangulation
 Â        ]
 Â        .\boost/type_traits/is_class.hpp(121) : see reference to class
 template instantiation 'boost::detail::is_class_impl<T>' being compiled
 Â        with
 Â        [
 Â            T=Triangulation::Face
 Â        ]
 Â        .\boost/type_traits/is_enum.hpp(43) : see reference to class
 template instantiation 'boost::is_class<T>' being compiled
 Â        with
 Â        [
 Â            T=Triangulation::Face
 Â        ]
 Â        .\boost/type_traits/is_enum.hpp(134) : see reference to class
 template instantiation 'boost::detail::is_class_or_union<T>' being
 compiled
 Â        with
 Â        [
 Â            T=Triangulation::Face
 Â        ]
 Â        .\boost/type_traits/is_enum.hpp(166) : see reference to class
 template instantiation 'boost::detail::is_enum_impl<T>' being compiled
 Â        with
 Â        [
 Â            T=Triangulation::Face
 Â        ]
 Â        .\boost/type_traits/is_scalar.hpp(29) : see reference to class
 template instantiation 'boost::is_enum<T>' being compiled
 Â        with
 Â        [
 Â            T=Triangulation::Face
 Â        ]
 Â        .\boost/type_traits/is_scalar.hpp(49) : see reference to class
 template instantiation 'boost::detail::is_scalar_impl<T>' being compiled
 Â        with
 Â        [
 Â            T=Triangulation::Face
 Â        ]
 Â        .\boost/type_traits/is_pod.hpp(34) : see reference to class
 template instantiation 'boost::is_scalar<T>' being compiled
 Â        with
 Â        [
 Â            T=Triangulation::Face
 Â        ]
 Â        .\boost/type_traits/is_pod.hpp(128) : see reference to class
 template instantiation 'boost::detail::is_pod_impl<T>' being compiled
 Â        with
 Â        [
 Â            T=Triangulation::Face
 Â        ]
 Â       
 c:\applis\downloads\boost_1_35_0\boost/mpl/aux_/preprocessed/plain/and.hpp(51)
 : see reference to class template instantiation 'boost::is_POD<T>' being
 compiled
 Â        with
 Â        [
 Â            T=Triangulation::Face
 Â        ]
 Â        .\boost/mpl/not.hpp(41) : see reference to class template
 instantiation 'boost::mpl::and_<T1,T2>' being compiled
 Â        with
 Â        [
 Â            T1=boost::is_POD<Triangulation::Face>,
 Â           
 T2=boost::detail::iterator_writability_disabled<Triangulation::Face,Face_base<Triangulation>
 &>
 Â        ]
 Â        .\boost/iterator/iterator_facade.hpp(382) : see reference to class
 template instantiation 'boost::mpl::not_<T>' being compiled
 Â        with
 Â        [
 Â           
 T=boost::mpl::and_<boost::is_POD<Triangulation::Face>,boost::detail::iterator_writability_disabled<Triangulation::Face,Face_base<Triangulation>
 &>>
 Â        ]
 Â        .\boost/mpl/if.hpp(63) : see reference to class template
 instantiation
 'boost::detail::use_operator_brackets_proxy<ValueType,Reference>' being
 compiled
 Â        with
 Â        [
 Â            ValueType=Triangulation::Face,
 Â            Reference=Face_base<Triangulation> &
 Â        ]
 Â        .\boost/iterator/iterator_facade.hpp(391) : see reference to class
 template instantiation 'boost::mpl::if_<T1,T2,T3>' being compiled
 Â        with
 Â        [
 Â           
 T1=boost::detail::use_operator_brackets_proxy<Triangulation::Face,Face_base<Triangulation>
 &>,
 Â           
 T2=boost::detail::operator_brackets_proxy<Iterator<Triangulation::Face>>,
 Â            T3=Triangulation::Face
 Â        ]
 Â        .\boost/iterator/iterator_facade.hpp(652) : see reference to class
 template instantiation
 'boost::detail::operator_brackets_result<Iterator,Value,Reference>' being
 compiled
 Â        with
 Â        [
 Â            Iterator=Iterator<Triangulation::Face>,
 Â            Value=Triangulation::Face,
 Â            Reference=Face_base<Triangulation> &
 Â        ]
 Â        facade.cpp(8) : see reference to class template instantiation
 'boost::iterator_facade<Derived,Value,CategoryOrTraversal>' being compiled
 Â        with
 Â        [
 Â            Derived=Iterator<Triangulation::Face>,
 Â            Value=Triangulation::Face,
 Â            CategoryOrTraversal=std::bidirectional_iterator_tag
 Â        ]
 Â        facade.cpp(32) : see reference to class template instantiation
 'Iterator<V>' being compiled
 Â        with
 Â        [
 Â            V=Triangulation::Face
 Â        ]
 Â        .\boost/type_traits/is_class.hpp(76) : see reference to class
 template instantiation 'Vertex_base<T>' being compiled
 Â        with
 Â        [
 Â            T=Triangulation
 Â        ]
 Â        .\boost/type_traits/is_class.hpp(121) : see reference to class
 template instantiation 'boost::detail::is_class_impl<T>' being compiled
 Â        with
 Â        [
 Â            T=Triangulation::Vertex
 Â        ]
 Â        .\boost/type_traits/is_enum.hpp(43) : see reference to class
 template instantiation 'boost::is_class<T>' being compiled
 Â        with
 Â        [
 Â            T=Triangulation::Vertex
 Â        ]
 Â        .\boost/type_traits/is_enum.hpp(134) : see reference to class
 template instantiation 'boost::detail::is_class_or_union<T>' being
 compiled
 Â        with
 Â        [
 Â            T=Triangulation::Vertex
 Â        ]
 Â        .\boost/type_traits/is_enum.hpp(166) : see reference to class
 template instantiation 'boost::detail::is_enum_impl<T>' being compiled
 Â        with
 Â        [
 Â            T=Triangulation::Vertex
 Â        ]
 Â        .\boost/type_traits/is_scalar.hpp(29) : see reference to class
 template instantiation 'boost::is_enum<T>' being compiled
 Â        with
 Â        [
 Â            T=Triangulation::Vertex
 Â        ]
 Â        .\boost/type_traits/is_scalar.hpp(49) : see reference to class
 template instantiation 'boost::detail::is_scalar_impl<T>' being compiled
 Â        with
 Â        [
 Â            T=Triangulation::Vertex
 Â        ]
 Â        .\boost/type_traits/is_pod.hpp(34) : see reference to class
 template instantiation 'boost::is_scalar<T>' being compiled
 Â        with
 Â        [
 Â            T=Triangulation::Vertex
 Â        ]
 Â        .\boost/type_traits/is_pod.hpp(128) : see reference to class
 template instantiation 'boost::detail::is_pod_impl<T>' being compiled
 Â        with
 Â        [
 Â            T=Triangulation::Vertex
 Â        ]
 Â       
 c:\applis\downloads\boost_1_35_0\boost/mpl/aux_/preprocessed/plain/and.hpp(51)
 : see reference to class template instantiation 'boost::is_POD<T>' being
 compiled
 Â        with
 Â        [
 Â            T=Triangulation::Vertex
 Â        ]
 Â        .\boost/mpl/not.hpp(41) : see reference to class template
 instantiation 'boost::mpl::and_<T1,T2>' being compiled
 Â        with
 Â        [
 Â            T1=boost::is_POD<Triangulation::Vertex>,
 Â           
 T2=boost::detail::iterator_writability_disabled<Triangulation::Vertex,Vertex_base<Triangulation>
 &>
 Â        ]
 Â        .\boost/iterator/iterator_facade.hpp(382) : see reference to class
 template instantiation 'boost::mpl::not_<T>' being compiled
 Â        with
 Â        [
 Â           
 T=boost::mpl::and_<boost::is_POD<Triangulation::Vertex>,boost::detail::iterator_writability_disabled<Triangulation::Vertex,Vertex_base<Triangulation>
 &>>
 Â        ]
 Â        .\boost/mpl/if.hpp(63) : see reference to class template
 instantiation
 'boost::detail::use_operator_brackets_proxy<ValueType,Reference>' being
 compiled
 Â        with
 Â        [
 Â            ValueType=Triangulation::Vertex,
 Â            Reference=Vertex_base<Triangulation> &
 Â        ]
 Â        .\boost/iterator/iterator_facade.hpp(391) : see reference to class
 template instantiation 'boost::mpl::if_<T1,T2,T3>' being compiled
 Â        with
 Â        [
 Â           
 T1=boost::detail::use_operator_brackets_proxy<Triangulation::Vertex,Vertex_base<Triangulation>
 &>,
 Â           
 T2=boost::detail::operator_brackets_proxy<Iterator<Triangulation::Vertex>>,
 Â            T3=Triangulation::Vertex
 Â        ]
 Â        .\boost/iterator/iterator_facade.hpp(652) : see reference to class
 template instantiation
 'boost::detail::operator_brackets_result<Iterator,Value,Reference>' being
 compiled
 Â        with
 Â        [
 Â            Iterator=Iterator<Triangulation::Vertex>,
 Â            Value=Triangulation::Vertex,
 Â            Reference=Vertex_base<Triangulation> &
 Â        ]
 Â        facade.cpp(8) : see reference to class template instantiation
 'boost::iterator_facade<Derived,Value,CategoryOrTraversal>' being compiled
 Â        with
 Â        [
 Â            Derived=Iterator<Triangulation::Vertex>,
 Â            Value=Triangulation::Vertex,
 Â            CategoryOrTraversal=std::bidirectional_iterator_tag
 Â        ]
 Â        facade.cpp(54) : see reference to class template instantiation
 'Iterator<V>' being compiled
 Â        with
 Â        [
 Â            V=Triangulation::Vertex
 Â        ]
 facade.cpp(42) : error C2079: 'Face_base<T>::V' uses undefined struct
 'Iterator<V>'
 Â        with
 Â        [
 Â            T=Triangulation
 Â        ]
 Â        and
 Â        [
 Â            V=Triangulation::Vertex
 Â        ]

 Compilation exited abnormally with code 2 at Thu Apr 24 13:19:24
 }}}

--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/1315#comment:1>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.


This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:57 UTC