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 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 _______________________________________________ cfe-dev mailing list cfe-dev@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev