[Boost-bugs] [Boost C++ Libraries] #9468: Missing include in boost/spirit/home/qi/string/detail/tst.hpp

Subject: [Boost-bugs] [Boost C++ Libraries] #9468: Missing include in boost/spirit/home/qi/string/detail/tst.hpp
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-12-04 00:57:49


#9468: Missing include in boost/spirit/home/qi/string/detail/tst.hpp
------------------------------+---------------------
 Reporter: amdmi3@… | Owner: djowel
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: spirit
  Version: Boost 1.52.0 | Severity: Problem
 Keywords: |
------------------------------+---------------------
 boost 1.52 on FreeBSD 10.0.

 boost/spirit/home/qi/string/tst_map.hpp has a forward declaration of
 struct tst_pass_through (which is actually declared in
 boost/spirit/home/qi/string/tst.hpp), however structure's operator() is
 called in tst_map::find():

 {{{
 return find(first, last, tst_pass_through());
 }}}

 This obviously won't compile due to incomplete type. This was discovered
 on boost 1.52, but since tst_map.hpp haven't changed since then in boost
 trunk, the bug still exists and needs fixing.

 Test program:

 {{{
 #include <boost/spirit/home/qi/string/tst_map.hpp>

 int main() {
         boost::spirit::qi::tst_map<char, int> map;
         int* x;
         map.find(x, x);
         return 0;
 }
 }}}

 clang output:

 {{{
 In file included from test.cc:1:
 /usr/local/include/boost/spirit/home/qi/string/tst_map.hpp:74:38: error:
 invalid use of incomplete type 'boost::spirit::qi::tst_pass_through'
             return find(first, last, tst_pass_through());
                                      ^~~~~~~~~~~~~~~~~~
 /usr/local/include/boost/spirit/home/qi/string/tst_map.hpp:20:12: note:
 forward declaration of 'boost::spirit::qi::tst_pass_through'
     struct tst_pass_through; // declared in tst.hpp
            ^
 1 error generated.
 }}}

 gcc output:

 {{{
 In file included from test.cc:1:0:
 /usr/local/include/boost/spirit/home/qi/string/tst_map.hpp: In
 instantiation of 'T* boost::spirit::qi::tst_map<Char, T>::find(Iterator&,
 Iterator) const [with Iterator = int*; Char = char; T = int]':
 test.cc:6:15: required from here
 /usr/local/include/boost/spirit/home/qi/string/tst_map.hpp:74:56: error:
 invalid use of incomplete type 'struct
 boost::spirit::qi::tst_pass_through'
              return find(first, last, tst_pass_through());
                                                         ^
 /usr/local/include/boost/spirit/home/qi/string/tst_map.hpp:20:12: error:
 forward declaration of 'struct boost::spirit::qi::tst_pass_through'
      struct tst_pass_through; // declared in tst.hpp
             ^
 }}}

 Patch is attached.

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