[cfe-commits] r67999 - in /cfe/trunk: lib/Sema/SemaDeclCXX.cpp lib/Sema/SemaOverload.cpp lib/Sema/SemaOverload.h test/SemaCXX/rval-references.cpp

Howard Hinnant hhinnant at apple.com
Wed Apr 1 10:17:31 PDT 2009


On Mar 29, 2009, at 11:27 AM, Sebastian Redl wrote:

> Author: cornedbee
> Date: Sun Mar 29 10:27:50 2009
> New Revision: 67999
>
> URL: http://llvm.org/viewvc/llvm-project?rev=67999&view=rev
> Log:
> Reintroduce r67870 (rval ref overloading), since I can't reproduce  
> any test failures on i386 or x86_64. If this fails for someone,  
> please contact me.

I don't have a comment on this particular commit, but since you're  
working the area...

Using g++-4.4 -std=c++0x I'm seeing an extraneous warning on this test  
code:

#include <assert.h>

int&&
g(int&& i)
{
     return static_cast<int&&>(i);  // line 6
}

int main()
{
     int i = g(2);
     assert(i == 2);
}

test.cpp:6: warning: returning reference to temporary

And I thought that the mistake may be common enough to catch clang as  
well, so I'm mentioning it here.  This is probably getting into an  
area recently described to me by Mike Miller (EDG) as "funny  
rvalues".  When you bind an rvalue reference to an rvalue, that rvalue  
now has some properties, such as identity that are new to rvalues.   
CWG issue 664 is also working this area:

http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#664

Thanks,
Howard




More information about the cfe-commits mailing list