[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cfe-dev
Subject:    Re: [cfe-dev] boost::ref issue
From:       Olivier Goffart <ogoffart () kde ! org>
Date:       2013-02-19 18:15:20
Message-ID: 3754411.9bF76J3YC6 () gargamel
[Download RAW message or body]

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

Configure | About | News | Add a list | Sponsored by KoreLogic