[cfe-dev] boost::ref issue

Laszlo Nagy rizsotto.mailinglist at gmail.com
Tue Feb 19 09:51:16 PST 2013

Hi All,

I'm trying to compile a C++ project with Clang. It compiles with gcc
without error, but Clang breaks. Unfortunately could not simplify further
and has 'boost' as dependency. I need some help.

How can I change the code to compile with clang? And if it is a not
expected behavior of Clang, what could be an error report for this?


$ clang++ -c test.cpp
test.cpp:9:64: error: no matching function for call to 'ref'
        std::for_each(v.begin(), v.end(), boost::bind(&S::bar,
boost::ref(this), _1));
/usr/include/boost/ref.hpp:64:63: note: candidate function [with T = S *]
not viable: no known conversion from 'S *' to 'S *&' for 1st argument
template<class T> inline reference_wrapper<T> BOOST_REF_CONST ref(T & t)
1 error generated.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130219/c26d5722/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.cpp
Type: text/x-c++src
Size: 267 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130219/c26d5722/attachment.cpp>

More information about the cfe-dev mailing list