On 03/19/2012 03:59 PM, Jason Merrill wrote:
OK.
Thanks. I committed the patch. I'm going to add, as obvious, the
following few additional tests, which my previous iteration got wrong.
Paolo.
//////////////////
2012-03-19 Paolo Carlini <paolo.carl...@oracle.com>
* g++.dg/warn/Wuseless-cast.C: Extend.
Index: testsuite/g++.dg/warn/Wuseless-cast.C
===================================================================
--- testsuite/g++.dg/warn/Wuseless-cast.C (revision 185528)
+++ testsuite/g++.dg/warn/Wuseless-cast.C (working copy)
@@ -58,6 +58,8 @@ template<typename T>
dynamic_cast<A&>(t);
}
+A prvalue();
+
void f()
{
int n;
@@ -90,6 +92,10 @@ void f()
#ifdef __GXX_EXPERIMENTAL_CXX0X__
(int&&)(42);
static_cast<int&&>(42);
+
+ (A&&)(prvalue());
+ const_cast<A&&>(prvalue());
+ static_cast<A&&>(prvalue());
#endif
A a;