[cfe-dev] boost::ref issue
Olivier Goffart
ogoffart at kde.org
Tue Feb 19 10:15:20 PST 2013
On Tuesday 19 February 2013 18:51:16 Laszlo Nagy wrote:
> 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?
>
> Thanks,
> Laszlo
>
I reduced your testcase:
template <typename T> void ref(T &) { return 8; }
struct S { int foo() { return ref(this); } };
I think it is GCC being wrong there. You should not be able to take a
reference from 'this'.
You can try boost::cref, or something like
S *that = this; ... boost::ref(that)
--
Olivier
More information about the cfe-dev
mailing list