From: Yuri (yuri_at_[hidden])
Date: 2025-06-14 03:01:04


I've encountered the compilation error with this program with
boost-libs-1.88.0:

#include <boost/dll/import.hpp>
#include <boost/shared_ptr.hpp>

class API {
public:
 Â Â Â Â Â Â Â API() { }
};

void x() {
 Â Â Â boost::shared_ptr<API> pluginInterface;

 Â Â Â pluginInterface = boost::dll::import_symbol<API>("path", "name");
}

The error:

$ c++ -std=c++20 -c s.cpp -I /usr/local/include/
s.cpp:13:21: error: no viable overloaded '='
 Â Â 13 |     pluginInterface = boost::dll::import_symbol<API>("path",
"name");
 Â Â Â Â Â |     ~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/boost/smart_ptr/shared_ptr.hpp:407:18: note:
candidate function not viable: no known conversion from
'boost::dll::detail::import_type<API>' (aka 'st
d::shared_ptr<API>') to 'const shared_ptr<API>' for 1st argument
 Â 407 |     shared_ptr & operator=( shared_ptr const & r ) noexcept
 Â Â Â Â Â |                  ^          ~~~~~~~~~~~~~~~~~~~~

Compiler: clang-19, but gcc-12 fails in a similar way.

It seems that such assignment should work.

This error was originally found in the Dakota project
(https://github.com/snl-dakota/dakota).

This error prevents the Dakota project from compiling.

Thanks,

Yuri