Opened 6 years ago

Closed 5 years ago

Last modified 5 years ago

#6103 closed Bugs (fixed)

boost::range_detail vs. boost::range::range_detail compiler error

Reported by: zeratul976@… Owned by: Neil Groves
Milestone: To Be Determined Component: range
Version: Boost 1.47.0 Severity: Problem
Keywords: Cc:


The following code:

#include <boost/range/algorithm/search_n.hpp>
#include <boost/range/join.hpp>

Produces the following compiler errors:

boost/range/join.hpp:44:39: error: expected template-name before '<' token
boost/range/join.hpp:44:39: error: expected '{' before '<' token
boost/range/join.hpp:44:39: error: expected unqualified-id before '<' token

The reason is that:

  • boost/range/algorithm/search_n.hpp introduces the namespace boost::range::range_detail
  • boost/range/join.hpp defines joined_type in boost::range_detail
  • boost/range/join.hpp then references range_detail::joined_type in boost::range, expecting it to resolve to boost::range_detail::joined_type, but due to the declaration in search_n.hpp, it resolves to boost::range::range_detail::joined_type (which does not exist)

This is easily fixable by fully qualifying boost::range_detail::joined_type in join.hpp, or by getting rid of the namespace boost::range::range_detail in search_n.hpp and using boost::range_detail instead.

Attachments (0)

Change History (5)

comment:1 Changed 6 years ago by anonymous

also see #6110 and #5627

comment:2 Changed 5 years ago by Mr. Vagina


comment:3 Changed 5 years ago by Nathan Ridge

Since search_n.hpp is the only header that uses the namespace boost::range::range_detail (everything else uses just boost::range_detail), I think the more principled solution is to change search_n.hpp to use boost::range_detail instead of boost::range::range_detail.

comment:4 Changed 5 years ago by Nathan Ridge

Resolution: fixed
Status: newclosed

(In [82071]) [range] corrected undesirable namespace nesting in algorithm/search_n.hpp; fixes #6103

comment:5 Changed 5 years ago by Nathan Ridge

(In [82139]) [range] merged bug fixes (r81890, refs #5603; r82071, refs #6103) from trunk

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Neil Groves.
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.