Boost C++ Libraries: Ticket #3278: invalid usage of std::list in match_results https://svn.boost.org/trac10/ticket/3278 <p> I use MSVC 9 with STLport 5.2.1. When compiling the following code snippet: </p> <pre class="wiki">#include &lt;string&gt; #include &lt;boost/xpressive/xpressive_dynamic.hpp&gt; namespace xpressive = boost::xpressive; int main(int, char*[]) { typedef xpressive::basic_regex&lt; std::string::const_iterator &gt; regex_t; regex_t rex = regex_t::compile(std::string("abc"), regex_t::ECMAScript | regex_t::optimize); return 0; } </pre><p> I get the following error: </p> <pre class="wiki">xpressive.cpp ../STLPort/stlport\stl/type_traits.h(249) : error C2139: 'boost::xpressive::match_results&lt;BidiIter&gt;' : 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&lt;_Tp&gt;' being compiled with [ _Tp=boost::xpressive::match_results&lt;const char *&gt; ] ../STLPort/stlport\stl/pointers/_list.h(61) : see reference to class template instantiation 'stlp_std::priv::_StorageType&lt;_Tp&gt;' being compiled with [ _Tp=boost::xpressive::match_results&lt;const char *&gt; ] .\boost/xpressive/detail/core/results_cache.hpp(43) : see reference to class template instantiation 'stlp_std::list&lt;_Tp&gt;' being compiled with [ _Tp=boost::xpressive::match_results&lt;const char *&gt; ] .\boost/xpressive/match_results.hpp(1341) : see reference to class template instantiation 'boost::xpressive::detail::nested_results&lt;BidiIter&gt;' being compiled with [ BidiIter=const char * ] .\boost/xpressive/detail/core/state.hpp(239) : see reference to class template instantiation 'boost::xpressive::match_results&lt;BidiIter&gt;' 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&lt;BidiIter&gt;::swap_context(boost::xpressive::detail::match_context&lt;BidiIter&gt; &amp;)' with [ BidiIter=const char * ] .\boost/xpressive/detail/core/matcher/end_matcher.hpp(35) : see reference to class template instantiation 'boost::xpressive::detail::match_state&lt;BidiIter&gt;' 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&lt;BidiIter,const T&gt;(boost::xpressive::detail::match_state&lt;BidiIter&gt; &amp;,const Next &amp;)' being compiled with [ BidiIter=const char *, T=const boost::xpressive::detail::matchable_ex&lt;const char *&gt;, Next=const boost::xpressive::detail::matchable_ex&lt;const char *&gt; ] .\boost/xpressive/detail/dynamic/dynamic.hpp(79) : while compiling class template member function 'bool boost::xpressive::detail::dynamic_xpression&lt;Matcher,BidiIter&gt;::match(boost::xpressive::detail::match_state&lt;BidiIter&gt; &amp;) 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&lt;Matcher,BidiIter&gt;' 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&lt;BidiIter&gt; boost::xpressive::detail::make_dynamic&lt;BidiIter,boost::xpressive::detail::end_matcher&gt;(const Matcher &amp;)' 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&lt;BidiIter&gt; boost::xpressive::regex_compiler&lt;BidiIter&gt;::compile_&lt;InputIter&gt;(FwdIter,FwdIter,boost::xpressive::regex_compiler&lt;BidiIter&gt;::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&lt;BidiIter&gt; boost::xpressive::regex_compiler&lt;BidiIter&gt;::compile&lt;const char*&gt;(InputIter,InputIter,boost::xpressive::regex_compiler&lt;BidiIter&gt;::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&lt;BidiIter&gt; boost::xpressive::regex_compiler&lt;BidiIter&gt;::compile&lt;InputRange&gt;(const InputRange &amp;,boost::xpressive::regex_compiler&lt;BidiIter&gt;::flag_type)' being compiled with [ BidiIter=const char *, InputRange=stlp_std::basic_string&lt;char,stlp_std::char_traits&lt;char&gt;,stlp_std::allocator&lt;char&gt;&gt; ] xpressive.cpp(9) : see reference to function template instantiation 'boost::xpressive::basic_regex&lt;BidiIter&gt; boost::xpressive::basic_regex&lt;BidiIter&gt;::compile&lt;stlp_std::basic_string&lt;_CharT,_Traits,_Alloc&gt;&gt;(const InputRange &amp;,boost::xpressive::basic_regex&lt;BidiIter&gt;::flag_type)' being compiled with [ BidiIter=const char *, _CharT=char, _Traits=stlp_std::char_traits&lt;char&gt;, _Alloc=stlp_std::allocator&lt;char&gt;, InputRange=stlp_std::basic_string&lt;char,stlp_std::char_traits&lt;char&gt;,stlp_std::allocator&lt;char&gt;&gt; ] ../STLPort/stlport\stl/type_traits.h(250) : error C2139: 'boost::xpressive::match_results&lt;BidiIter&gt;' : 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&lt;BidiIter&gt;' : 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&lt;BidiIter&gt;' : 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&lt;BidiIter&gt;' : 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&lt;BidiIter&gt;' with [ BidiIter=const char * ] ../STLPort/stlport\stl/pointers/_tools.h(79) : error C2227: left of '-&gt;{dtor}' must point to class/struct/union/generic type type is 'boost::xpressive::detail::match_state&lt;BidiIter&gt; *const ' with [ BidiIter=const char * ] ../STLPort/stlport\stl/pointers/_tools.h(79) : fatal error C1903: unable to recover from previous error(s); stopping compilation </pre><p> I assume the problem is that nested_results&lt; <a class="missing wiki">BidiIter</a> &gt; template derives from std::list&lt; match_results&lt; <a class="missing wiki">BidiIter</a> &gt; &gt;, but at this point match_results is not complete because the nested_results template is instantiated by match_results&lt; <a class="missing wiki">BidiIter</a> &gt;::nested_results_ member variable. The Standard forbids to instantiate STL containers on incomplete types, so I guess, STLport has no issue here. </p> <p> Just in case you try to reproduce, I have these macros defined: _STLP_USE_TEMPLATE_EXPRESSION=1, _STLP_USE_PTR_SPECIALIZATIONS=1. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3278 Trac 1.4.3 Eric Niebler Mon, 20 Jul 2009 20:59:22 GMT status changed https://svn.boost.org/trac10/ticket/3278#comment:1 https://svn.boost.org/trac10/ticket/3278#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> Ticket Eric Niebler Tue, 27 Oct 2009 13:22:12 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/3278#comment:2 https://svn.boost.org/trac10/ticket/3278#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/57174" title="nested results uses a custom list type that allows incomplete types, ...">[57174]</a>) nested results uses a custom list type that allows incomplete types, does no dynamic allocation in the default constructor, and has a guarnteed O(1) splice; fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3278" title="#3278: Bugs: invalid usage of std::list in match_results (closed: fixed)">#3278</a> </p> Ticket