Opened 5 years ago

Closed 3 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:


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
/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
/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]':   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@… 5 years ago.

Download all attachments as: .zip

Change History (5)

Changed 5 years ago by amdmi3@…

Attachment: tst_map.hpp.patch added

comment:1 Changed 3 years ago by anonymous

Still present in Boost 1.55, FreeBSD 10.2 ...

comment:2 Changed 3 years ago by Joel de Guzman

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

make sure you do it against develop.

comment:4 Changed 3 years ago by Joel de Guzman

Resolution: fixed
Status: newclosed

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Joel de Guzman.
The resolution will be deleted.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.