Opened 11 years ago
Closed 11 years ago
#5688 closed Bugs (fixed)
boost::asio::async_read_until with boost::regex compilation error
Reported by: | Owned by: | chris_kohlhoff | |
---|---|---|---|
Milestone: | To Be Determined | Component: | asio |
Version: | Boost 1.47.0 | Severity: | Regression |
Keywords: | async_read_until | Cc: |
Description
This little test program fails to compile with Boost 1.47. I've been using Boost 1.44 previously, and Asio and Regex were getting along just fine.
#include <boost/asio/io_service.hpp> #include <boost/asio/ip/tcp.hpp> #include <boost/asio/read_until.hpp> #include <boost/asio/streambuf.hpp> #include <boost/regex.hpp> void handler(const boost::system::error_code& e, std::size_t size) {} int main() { boost::asio::io_service ios; boost::asio::ip::tcp::socket s(ios); boost::asio::streambuf b; boost::asio::async_read_until(s, b, boost::regex("i am just a regex"), handler); }
/home/monsta/work/sandbox/include/boost/asio/impl/read_until.hpp: In function ‘void boost::asio::async_read_until(AsyncReadStream&, boost::asio::basic_streambuf<Allocator>&, const boost::regex&, const ReadHandler&) [with AsyncReadStream = boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >, Allocator = std::allocator<char>, ReadHandler = void ()(const boost::system::error_code&, size_t)]’: ../../src/asio-regex-test.cpp:14: instantiated from here /home/monsta/work/sandbox/include/boost/asio/impl/read_until.hpp:880: error: no matching function for call to ‘make_read_until_expr_op(boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >&, boost::asio::basic_streambuf<std::allocator<char> >&, const boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >&, void (&)(const boost::system::error_code&, size_t))’
Change History (6)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
I just hit this too. It was a bit painful to track down and it wasn't till *after* I figured out it was the regex that I had enough search terms to find this ticket.
comment:3 by , 11 years ago
This is a simple fix. Replace the function signature from:
make_read_until_expr_op(AsyncReadStream& s,
boost::asio::basic_streambuf<Allocator>& b, const boost::regex& expr, ReadHandler handler)
to:
make_read_until_expr_op(AsyncReadStream& s,
boost::asio::basic_streambuf<Allocator>& b, RegEx expr, ReadHandler handler)
comment:4 by , 11 years ago
I, also, just hit this. Unfortunately, the fix above does not change the compiler error for me (although I certainly seems like it should!).
comment:5 by , 11 years ago
comment:6 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
(In [74863]) Merge from trunk...
Fix compile error in regex overload of async_read_until.hpp. Fixes #5688
Explicitly specify the signal() function from the global namespace. Fixes #5722
Don't read the clock unless the heap is non-empty.
Change the SSL buffers sizes so that they're large enough to hold a complete TLS record. Fixes #5854
Make sure the synchronous null_buffers operations obey the user's non_blocking setting. Fixes #5756
Set size of select fd_set at runtime when using Windows.
Disable warning due to const qualifier being applied to function type.
Fix crash due to gcc_x86_fenced_block that shows up when using the Intel C++ compiler. Fixes #5763
Specialise operations for buffer sequences that are arrays of exactly two buffers.
Initialise all OpenSSL algorithms.
Fix error mapping when session is gracefully shut down.
Various performance improvements:
- Split the task_io_service's run and poll code.
- Use thread-local operation queues in single-threaded use cases (i.e. concurrency_hint is 1) to eliminate a lock/unlock pair.
- Only fence block exit when a handler is being run directly out of the io_service.
- Prefer x86 mfence-based fenced block when available.
- Use a plain ol' long for the atomic_count when all thread support is disabled.
- Allow some epoll_reactor speculative operations to be performed without holding the lock.
- Improve locality of reference by performing an epoll_reactor's I/O operation immediately before the corresponding handler is called. This also improves scalability across CPUs when multiple threads are running the io_service.
- Pass same error_code variable through to each operation's complete() function.
- Optimise creation of and access to the io_service implementation.
Remove unused state in HTTP server examples.
Add latency test programs.
I hit the same problem.
I believe that the error locates at asio/impl/read_until.hpp:859 where
typename RegEx
template parameter is declared but not used as the the member function definition says `const boost::regex& expr
'.I guess the it should say `
const RegEx & expr
' etc.An excerpt from asio/impl/read_until.hpp:859:
If I'm missing something deeper here, the documentation should be perhaps updated to reflect changes (didn't spot anything related to
async_read_until
).