Boost C++ Libraries: Ticket #5688: boost::asio::async_read_until with boost::regex compilation error https://svn.boost.org/trac10/ticket/5688 <p> 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. </p> <pre class="wiki">#include &lt;boost/asio/io_service.hpp&gt; #include &lt;boost/asio/ip/tcp.hpp&gt; #include &lt;boost/asio/read_until.hpp&gt; #include &lt;boost/asio/streambuf.hpp&gt; #include &lt;boost/regex.hpp&gt; void handler(const boost::system::error_code&amp; 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); } </pre><pre class="wiki">/home/monsta/work/sandbox/include/boost/asio/impl/read_until.hpp: In function ‘void boost::asio::async_read_until(AsyncReadStream&amp;, boost::asio::basic_streambuf&lt;Allocator&gt;&amp;, const boost::regex&amp;, const ReadHandler&amp;) [with AsyncReadStream = boost::asio::basic_stream_socket&lt;boost::asio::ip::tcp, boost::asio::stream_socket_service&lt;boost::asio::ip::tcp&gt; &gt;, Allocator = std::allocator&lt;char&gt;, ReadHandler = void ()(const boost::system::error_code&amp;, 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&lt;boost::asio::ip::tcp, boost::asio::stream_socket_service&lt;boost::asio::ip::tcp&gt; &gt;&amp;, boost::asio::basic_streambuf&lt;std::allocator&lt;char&gt; &gt;&amp;, const boost::basic_regex&lt;char, boost::regex_traits&lt;char, boost::cpp_regex_traits&lt;char&gt; &gt; &gt;&amp;, void (&amp;)(const boost::system::error_code&amp;, size_t))’ </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5688 Trac 1.4.3 pexu@… Tue, 19 Jul 2011 12:43:48 GMT <link>https://svn.boost.org/trac10/ticket/5688#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5688#comment:1</guid> <description> <p> I hit the same problem. </p> <p> I believe that the error locates at asio/impl/read_until.hpp:859 where <code>typename RegEx</code> template parameter is declared but not used as the the member function definition says `<code>const boost::regex&amp; expr</code>'. </p> <p> I guess the it should say `<code>const RegEx &amp; expr</code>' etc. </p> <p> An excerpt from asio/impl/read_until.hpp:859: </p> <pre class="wiki"> template &lt;typename AsyncReadStream, typename Allocator, typename RegEx, typename ReadHandler&gt; inline read_until_expr_op&lt;AsyncReadStream, Allocator, RegEx, ReadHandler&gt; make_read_until_expr_op(AsyncReadStream&amp; s, boost::asio::basic_streambuf&lt;Allocator&gt;&amp; b, const boost::regex&amp; expr, ReadHandler handler) { return read_until_expr_op&lt;AsyncReadStream, Allocator, RegEx, ReadHandler&gt;( s, b, expr, handler); } </pre><p> If I'm missing something deeper here, the documentation should be perhaps updated to reflect changes (didn't spot anything related to <code>async_read_until</code>). </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Fri, 05 Aug 2011 20:14:46 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5688#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5688#comment:2</guid> <description> <p> 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. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Wed, 10 Aug 2011 15:37:41 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5688#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5688#comment:3</guid> <description> <p> This is a simple fix. Replace the function signature from: </p> <blockquote> <p> make_read_until_expr_op(<a class="missing wiki">AsyncReadStream</a>&amp; s, </p> <blockquote> <p> boost::asio::basic_streambuf&lt;Allocator&gt;&amp; b, const boost::regex&amp; expr, <a class="missing wiki">ReadHandler</a> handler) </p> </blockquote> </blockquote> <p> to: </p> <blockquote> <p> make_read_until_expr_op(<a class="missing wiki">AsyncReadStream</a>&amp; s, </p> <blockquote> <p> boost::asio::basic_streambuf&lt;Allocator&gt;&amp; b, <a class="missing wiki">RegEx</a> expr, <a class="missing wiki">ReadHandler</a> handler) </p> </blockquote> </blockquote> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Wed, 07 Sep 2011 20:56:04 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5688#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5688#comment:4</guid> <description> <p> I, also, just hit this. Unfortunately, the fix above does not change the compiler error for me (although I certainly seems like it should!). </p> </description> <category>Ticket</category> </item> <item> <dc:creator>chris_kohlhoff</dc:creator> <pubDate>Sat, 08 Oct 2011 21:03:24 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5688#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5688#comment:5</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/74814" title="Fix compile error in regex overload of async_read_until.hpp. Refs #5688">[74814]</a>) Fix compile error in regex overload of async_read_until.hpp. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5688" title="#5688: Bugs: boost::asio::async_read_until with boost::regex compilation error (closed: fixed)">#5688</a> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>chris_kohlhoff</dc:creator> <pubDate>Sun, 09 Oct 2011 22:00:09 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/5688#comment:6 https://svn.boost.org/trac10/ticket/5688#comment:6 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/74863" title="Merge from trunk... Fix compile error in regex overload of ...">[74863]</a>) Merge from trunk... </p> <p> Fix compile error in regex overload of async_read_until.hpp. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5688" title="#5688: Bugs: boost::asio::async_read_until with boost::regex compilation error (closed: fixed)">#5688</a> </p> <p> Explicitly specify the signal() function from the global namespace. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5722" title="#5722: Bugs: Compilation error when boost/signals.hpp is included before asio.hpp (closed: fixed)">#5722</a> </p> <p> Don't read the clock unless the heap is non-empty. </p> <p> Change the SSL buffers sizes so that they're large enough to hold a complete TLS record. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5854" title="#5854: Bugs: asio::ssl::stream holds last 16K until shutdown IF last buffer is on ... (closed: fixed)">#5854</a> </p> <p> Make sure the synchronous null_buffers operations obey the user's non_blocking setting. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5756" title="#5756: Bugs: read_some() with null_buffers blocks in non-blocking mode (closed: fixed)">#5756</a> </p> <p> Set size of select fd_set at runtime when using Windows. </p> <p> Disable warning due to const qualifier being applied to function type. </p> <p> Fix crash due to gcc_x86_fenced_block that shows up when using the Intel C++ compiler. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5763" title="#5763: Patches: Segmentation fault in ASIO signal handler (closed: fixed)">#5763</a> </p> <p> Specialise operations for buffer sequences that are arrays of exactly two buffers. </p> <p> Initialise all OpenSSL algorithms. </p> <p> Fix error mapping when session is gracefully shut down. </p> <p> Various performance improvements: </p> <ul><li>Split the task_io_service's run and poll code. </li></ul><ul><li>Use thread-local operation queues in single-threaded use cases (i.e. concurrency_hint is 1) to eliminate a lock/unlock pair. </li></ul><ul><li>Only fence block exit when a handler is being run directly out of the io_service. </li></ul><ul><li>Prefer x86 mfence-based fenced block when available. </li></ul><ul><li>Use a plain ol' long for the atomic_count when all thread support is disabled. </li></ul><ul><li>Allow some epoll_reactor speculative operations to be performed without holding the lock. </li></ul><ul><li>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. </li></ul><ul><li>Pass same error_code variable through to each operation's complete() function. </li></ul><ul><li>Optimise creation of and access to the io_service implementation. </li></ul><p> Remove unused state in HTTP server examples. </p> <p> Add latency test programs. </p> Ticket