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

Sebastian Redl sebastian.redl at getdesigned.at
Wed Apr 1 12:14:19 PDT 2009


Howard Hinnant wrote:
> 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.
I'll add a test case.
>   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
I believe issue 664 is moot now that rvalue refs cannot bind to lvalues.

Sebastian



More information about the cfe-commits mailing list