Opened 9 years ago

Closed 7 years ago

#9468 closed Bugs (fixed)

Missing include in boost/spirit/home/qi/string/detail/tst.hpp

Reported by: amdmi3@… Owned by: Joel de Guzman
Milestone: To Be Determined Component: spirit
Version: Boost 1.52.0 Severity: Problem
Keywords: Cc:

Description

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.

Attachments (1)

tst_map.hpp.patch (653 bytes ) - added by amdmi3@… 9 years ago.

Download all attachments as: .zip

Change History (5)

by amdmi3@…, 9 years ago

Attachment: tst_map.hpp.patch added

comment:1 by anonymous, 7 years ago

Still present in Boost 1.55, FreeBSD 10.2 ...

comment:2 by Joel de Guzman, 7 years ago

Could you please issue a Pull Request instead? That way, we can keep track of contributors:

https://github.com/boostorg/spirit/tree/develop

make sure you do it against develop.

comment:4 by Joel de Guzman, 7 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.