[Boost-bugs] [Boost C++ Libraries] #3278: invalid usage of std::list in match_results

Subject: [Boost-bugs] [Boost C++ Libraries] #3278: invalid usage of std::list in match_results
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-07-19 20:20:35


#3278: invalid usage of std::list in match_results
-------------------------------+--------------------------------------------
 Reporter: andysem | Owner: eric_niebler
     Type: Bugs | Status: new
Milestone: Boost 1.40.0 | Component: xpressive
  Version: Boost 1.39.0 | Severity: Showstopper
 Keywords: stlport xpressive |
-------------------------------+--------------------------------------------
 I use MSVC 9 with STLport 5.2.1. When compiling the following code
 snippet:

 {{{
 #include <string>
 #include <boost/xpressive/xpressive_dynamic.hpp>

 namespace xpressive = boost::xpressive;

 int main(int, char*[])
 {
     typedef xpressive::basic_regex< std::string::const_iterator > regex_t;
     regex_t rex = regex_t::compile(std::string("abc"), regex_t::ECMAScript
 | regex_t::optimize);

     return 0;
 }
 }}}

 I get the following error:

 {{{
 xpressive.cpp
 ../STLPort/stlport\stl/type_traits.h(249) : error C2139:
 'boost::xpressive::match_results<BidiIter>' : an undefined class is not
 allowed as an argument to compiler intrinsic type trait
 '__has_trivial_constructor'
         with
         [
             BidiIter=const char *
         ]
         ../STLPort/stlport\stl/pointers/_tools.h(76) : see reference to
 class template instantiation 'stlp_std::__type_traits<_Tp>' being compiled
         with
         [
             _Tp=boost::xpressive::match_results<const char *>
         ]
         ../STLPort/stlport\stl/pointers/_list.h(61) : see reference to
 class template instantiation 'stlp_std::priv::_StorageType<_Tp>' being
 compiled
         with
         [
             _Tp=boost::xpressive::match_results<const char *>
         ]
         .\boost/xpressive/detail/core/results_cache.hpp(43) : see
 reference to class template instantiation 'stlp_std::list<_Tp>' being
 compiled
         with
         [
             _Tp=boost::xpressive::match_results<const char *>
         ]
         .\boost/xpressive/match_results.hpp(1341) : see reference to class
 template instantiation
 'boost::xpressive::detail::nested_results<BidiIter>' being compiled
         with
         [
             BidiIter=const char *
         ]
         .\boost/xpressive/detail/core/state.hpp(239) : see reference to
 class template instantiation 'boost::xpressive::match_results<BidiIter>'
 being compiled
         with
         [
             BidiIter=const char *
         ]
         .\boost/xpressive/detail/core/state.hpp(235) : while compiling
 class template member function 'void
 boost::xpressive::detail::match_state<BidiIter>::swap_context(boost::xpressive::detail::match_context<BidiIter>
 &)'
         with
         [
             BidiIter=const char *
         ]
         .\boost/xpressive/detail/core/matcher/end_matcher.hpp(35) : see
 reference to class template instantiation
 'boost::xpressive::detail::match_state<BidiIter>' being compiled
         with
         [
             BidiIter=const char *
         ]
         .\boost/xpressive/detail/dynamic/dynamic.hpp(80) : see reference
 to function template instantiation 'bool
 boost::xpressive::detail::end_matcher::match<BidiIter,const
 T>(boost::xpressive::detail::match_state<BidiIter> &,const Next &)' being
 compiled
         with
         [
             BidiIter=const char *,
             T=const boost::xpressive::detail::matchable_ex<const char *>,
             Next=const boost::xpressive::detail::matchable_ex<const char
 *>
         ]
         .\boost/xpressive/detail/dynamic/dynamic.hpp(79) : while compiling
 class template member function 'bool
 boost::xpressive::detail::dynamic_xpression<Matcher,BidiIter>::match(boost::xpressive::detail::match_state<BidiIter>
 &) const'
         with
         [
             Matcher=boost::xpressive::detail::end_matcher,
             BidiIter=const char *
         ]
         .\boost/xpressive/detail/dynamic/dynamic.hpp(164) : see reference
 to class template instantiation
 'boost::xpressive::detail::dynamic_xpression<Matcher,BidiIter>' being
 compiled
         with
         [
             Matcher=boost::xpressive::detail::end_matcher,
             BidiIter=const char *
         ]
         .\boost/xpressive/regex_compiler.hpp(216) : see reference to
 function template instantiation
 'boost::xpressive::detail::sequence<BidiIter>
 boost::xpressive::detail::make_dynamic<BidiIter,boost::xpressive::detail::end_matcher>(const
 Matcher &)' being compiled
         with
         [
             BidiIter=const char *,
             Matcher=boost::xpressive::detail::end_matcher
         ]
         .\boost/xpressive/regex_compiler.hpp(120) : see reference to
 function template instantiation 'boost::xpressive::basic_regex<BidiIter>
 boost::xpressive::regex_compiler<BidiIter>::compile_<InputIter>(FwdIter,FwdIter,boost::xpressive::regex_compiler<BidiIter>::flag_type,stlp_std::forward_iterator_tag)'
 being compiled
         with
         [
             BidiIter=const char *,
             InputIter=const char *,
             FwdIter=const char *
         ]
         .\boost/xpressive/regex_compiler.hpp(129) : see reference to
 function template instantiation 'boost::xpressive::basic_regex<BidiIter>
 boost::xpressive::regex_compiler<BidiIter>::compile<const
 char*>(InputIter,InputIter,boost::xpressive::regex_compiler<BidiIter>::flag_type)'
 being compiled
         with
         [
             BidiIter=const char *,
             InputIter=const char *
         ]
         .\boost/xpressive/basic_regex.hpp(191) : see reference to function
 template instantiation 'boost::xpressive::basic_regex<BidiIter>
 boost::xpressive::regex_compiler<BidiIter>::compile<InputRange>(const
 InputRange &,boost::xpressive::regex_compiler<BidiIter>::flag_type)' being
 compiled
         with
         [
             BidiIter=const char *,
 InputRange=stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>
         ]
         xpressive.cpp(9) : see reference to function template
 instantiation 'boost::xpressive::basic_regex<BidiIter>
 boost::xpressive::basic_regex<BidiIter>::compile<stlp_std::basic_string<_CharT,_Traits,_Alloc>>(const
 InputRange &,boost::xpressive::basic_regex<BidiIter>::flag_type)' being
 compiled
         with
         [
             BidiIter=const char *,
             _CharT=char,
             _Traits=stlp_std::char_traits<char>,
             _Alloc=stlp_std::allocator<char>,
 InputRange=stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>
         ]
 ../STLPort/stlport\stl/type_traits.h(250) : error C2139:
 'boost::xpressive::match_results<BidiIter>' : an undefined class is not
 allowed as an argument to compiler intrinsic type trait
 '__has_trivial_copy'
         with
         [
             BidiIter=const char *
         ]
 ../STLPort/stlport\stl/type_traits.h(251) : error C2139:
 'boost::xpressive::match_results<BidiIter>' : an undefined class is not
 allowed as an argument to compiler intrinsic type trait
 '__has_trivial_assign'
         with
         [
             BidiIter=const char *
         ]
 ../STLPort/stlport\stl/type_traits.h(252) : error C2139:
 'boost::xpressive::match_results<BidiIter>' : an undefined class is not
 allowed as an argument to compiler intrinsic type trait
 '__has_trivial_destructor'
         with
         [
             BidiIter=const char *
         ]
 ../STLPort/stlport\stl/type_traits.h(253) : error C2139:
 'boost::xpressive::match_results<BidiIter>' : an undefined class is not
 allowed as an argument to compiler intrinsic type trait '__is_pod'
         with
         [
             BidiIter=const char *
         ]
 ../STLPort/stlport\stl/pointers/_tools.h(79) : error C2027: use of
 undefined type 'boost::xpressive::match_results<BidiIter>'
         with
         [
             BidiIter=const char *
         ]
 ../STLPort/stlport\stl/pointers/_tools.h(79) : error C2227: left of
 '->{dtor}' must point to class/struct/union/generic type
         type is 'boost::xpressive::detail::match_state<BidiIter> *const '
         with
         [
             BidiIter=const char *
         ]
 ../STLPort/stlport\stl/pointers/_tools.h(79) : fatal error C1903: unable
 to recover from previous error(s); stopping compilation
 }}}

 I assume the problem is that nested_results< BidiIter > template derives
 from std::list< match_results< BidiIter > >, but at this point
 match_results is not complete because the nested_results template is
 instantiated by match_results< BidiIter >::nested_results_ member
 variable. The Standard forbids to instantiate STL containers on incomplete
 types, so I guess, STLport has no issue here.

 Just in case you try to reproduce, I have these macros defined:
 _STLP_USE_TEMPLATE_EXPRESSION=1, _STLP_USE_PTR_SPECIALIZATIONS=1.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/3278>
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:50:00 UTC