Fix handling of const_cast from prvalue to rvalue reference: such a cast is
only permitted if the source object is of class type, and should materialize a
temporary for the reference to bind to.
llvm-svn: 184017
diff --git a/clang/test/SemaCXX/const-cast.cpp b/clang/test/SemaCXX/const-cast.cpp
index 62851f8..1fe350d 100644
--- a/clang/test/SemaCXX/const-cast.cpp
+++ b/clang/test/SemaCXX/const-cast.cpp
@@ -38,6 +38,7 @@
f *fpp = const_cast<f*>(&fp);
int const A::* const A::*icapcap = 0;
int A::* A::* iapap = const_cast<int A::* A::*>(icapcap);
+ (void)const_cast<A&&>(A()); // expected-warning {{C++11}}
return var4;
}
@@ -60,5 +61,6 @@
f fp2 = const_cast<f>(fp1); // expected-error {{const_cast to 'f' (aka 'int (*)(int)'), which is not a reference, pointer-to-object, or pointer-to-data-member}}
void (A::*mfn)() = 0;
(void)const_cast<void (A::*)()>(mfn); // expected-error {{const_cast to 'void (A::*)()', which is not a reference, pointer-to-object, or pointer-to-data-member}}
+ (void)const_cast<int&&>(0); // expected-error {{const_cast from rvalue to reference type 'int &&'}} expected-warning {{C++11}}
return **var3;
}