https://bugs.llvm.org/show_bug.cgi?id=45953
Bug ID: 45953
Summary: Code for virtual function not generated
Product: clang
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++17
Assignee: unassignedclangb...@nondot.org
Reporter: profcl...@gmail.com
CC: blitzrak...@gmail.com, erik.pilking...@gmail.com,
llvm-bugs@lists.llvm.org, richard-l...@metafoo.co.uk
Created attachment 23496
--> https://bugs.llvm.org/attachment.cgi?id=23496&action=edit
Test code
For the attached C++17 code involving Boost.Beast, clang++ gives an "undefined
symbol" error (full message below). It appears that the code for the function
"boost::beast::stable_async_base<...>::before_invoke_hook()" is not generated,
leading to the error. It works with g++.
The error occurs with the LLVM 10.0.0 prebuilt binary for Ubuntu x86_64 and
using the Boost library version 1.73.0, on Linux Mint 19.3. It happens with
both LD and LLD. The Boost libraries were compiled with clang as well, but I
think this is not really relevant as the missing function is a template and
should be generated when compiling the application.
The code is compiled with "clang++ test.cpp -fuse-ld=lld -lboost_system
-pthread -lssl -lcrypto".
This is the missing function:
https://github.com/boostorg/beast/blob/boost-1.73.0/include/boost/beast/core/async_base.hpp#L193
The attached code of course makes zero sense, but appears to be the minimal
amount that reproduces the problem. It is unnecessarily contrived and I have
since been pointed to a better (and working) solution, but there may still be a
bug in Clang/LLVM that could be worth fixing.
The full linker error is:
ld.lld: error: undefined symbol: boost::beast::stable_async_base<void
LoaderConnection::onResolve<int>(int&&, boost::system::error_code const&,
boost::asio::ip::basic_resolver_results<boost::asio::ip::tcp>
const&)::'lambda'(boost::system::error_code const&, unsigned long),
boost::asio::executor, std::allocator<void> >::before_invoke_hook()
>>> referenced by test.cpp
>>> /tmp/test-223f2a.o:(vtable for
>>> boost::beast::http::detail::write_msg_op<void
>>> LoaderConnection::onResolve<int>(int&&, boost::system::error_code const&,
>>> boost::asio::ip::basic_resolver_results<boost::asio::ip::tcp>
>>> const&)::'lambda'(boost::system::error_code const&, unsigned long),
>>> boost::beast::ssl_stream<boost::beast::basic_stream<boost::asio::ip::tcp,
>>> boost::asio::executor, boost::beast::unlimited_rate_policy> >, true,
>>> boost::beast::http::empty_body,
>>> boost::beast::http::basic_fields<std::allocator<char> > >)
>>> referenced by test.cpp
>>> /tmp/test-223f2a.o:(vtable for
>>> boost::beast::stable_async_base<void
>>> LoaderConnection::onResolve<int>(int&&, boost::system::error_code const&,
>>> boost::asio::ip::basic_resolver_results<boost::asio::ip::tcp>
>>> const&)::'lambda'(boost::system::error_code const&, unsigned long),
>>> boost::asio::executor, std::allocator<void> >)
ld.lld: error: undefined symbol:
boost::beast::detail::allocate_stable_state<boost::beast::http::serializer<true,
boost::beast::http::empty_body,
boost::beast::http::basic_fields<std::allocator<char> > >, std::allocator<void>
>::~allocate_stable_state()
>>> referenced by test.cpp
>>> /tmp/test-223f2a.o:(vtable for
>>> boost::beast::detail::allocate_stable_state<boost::beast::http::serializer<true,
>>> boost::beast::http::empty_body,
>>> boost::beast::http::basic_fields<std::allocator<char> > >,
>>> std::allocator<void> >)
ld.lld: error: undefined symbol:
boost::beast::detail::allocate_stable_state<boost::beast::http::serializer<true,
boost::beast::http::empty_body,
boost::beast::http::basic_fields<std::allocator<char> > >, std::allocator<void>
>::~allocate_stable_state()
>>> referenced by test.cpp
>>> /tmp/test-223f2a.o:(vtable for
>>> boost::beast::detail::allocate_stable_state<boost::beast::http::serializer<true,
>>> boost::beast::http::empty_body,
>>> boost::beast::http::basic_fields<std::allocator<char> > >,
>>> std::allocator<void> >)
ld.lld: error: undefined symbol:
boost::beast::detail::allocate_stable_state<boost::beast::http::serializer<true,
boost::beast::http::empty_body,
boost::beast::http::basic_fields<std::allocator<char> > >, std::allocator<void>
>::destroy()
>>> referenced by test.cpp
>>> /tmp/test-223f2a.o:(vtable for
>>> boost::beast::detail::allocate_stable_state<boost::beast::http::serializer<true,
>>> boost::beast::http::empty_body,
>>> boost::beast::http::basic_fields<std::allocator<char> > >,
>>> std::allocator<void> >)
clang-10: error: linker command failed with exit code 1 (use -v to see
invocation)
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs