diff options
Diffstat (limited to 'test/CXX/expr/expr.post')
-rw-r--r-- | test/CXX/expr/expr.post/expr.call/p7-0x.cpp | 7 | ||||
-rw-r--r-- | test/CXX/expr/expr.post/expr.const.cast/p1-0x.cpp | 20 |
2 files changed, 22 insertions, 5 deletions
diff --git a/test/CXX/expr/expr.post/expr.call/p7-0x.cpp b/test/CXX/expr/expr.post/expr.call/p7-0x.cpp index 018609d..fbb685c 100644 --- a/test/CXX/expr/expr.post/expr.call/p7-0x.cpp +++ b/test/CXX/expr/expr.post/expr.call/p7-0x.cpp @@ -20,11 +20,16 @@ struct X4 { void vararg(...); +void g(); + void f(X1 x1, X2 x2, X3 x3, X4 x4) { vararg(x1); // OK vararg(x2); // expected-error{{cannot pass object of non-trivial type 'X2' through variadic function; call will abort at runtime}} vararg(x3); // OK vararg(x4); // expected-error{{cannot pass object of non-trivial type 'X4' through variadic function; call will abort at runtime}} + + vararg(g()); // expected-error{{cannot pass expression of type 'void' to variadic function}} + vararg({1, 2, 3}); // expected-error{{cannot pass initializer list to variadic function}} } @@ -33,7 +38,7 @@ namespace PR11131 { S &getS(); - void f(...); + int f(...); void g() { (void)sizeof(f(getS())); diff --git a/test/CXX/expr/expr.post/expr.const.cast/p1-0x.cpp b/test/CXX/expr/expr.post/expr.const.cast/p1-0x.cpp index 76ea96f..f4c0f1a 100644 --- a/test/CXX/expr/expr.post/expr.const.cast/p1-0x.cpp +++ b/test/CXX/expr/expr.post/expr.const.cast/p1-0x.cpp @@ -6,14 +6,26 @@ unsigned int f(int); +struct X {}; + template<typename T> T& lvalue(); template<typename T> T&& xvalue(); template<typename T> T prvalue(); -void test_classification(const int *ptr) { - int *ptr0 = const_cast<int *&&>(ptr); - int *ptr1 = const_cast<int *&&>(xvalue<const int*>()); - int *ptr2 = const_cast<int *&&>(prvalue<const int*>()); +void test_classification(const int *ptr, X x) { + int *&&ptr0 = const_cast<int *&&>(ptr); + int *&&ptr1 = const_cast<int *&&>(xvalue<const int*>()); + int *&&ptr2 = const_cast<int *&&>(prvalue<const int*>()); // expected-error {{const_cast from rvalue to reference type 'int *&&'}} + X &&ptr3 = const_cast<X&&>(x); + X &&ptr4 = const_cast<X&&>(xvalue<X>()); + X &&ptr5 = const_cast<X&&>(prvalue<X>()); + + int *&ptr6 = const_cast<int *&>(ptr); + int *&ptr7 = const_cast<int *&>(xvalue<const int*>()); // expected-error {{const_cast from rvalue to reference type 'int *&'}} + int *&ptr8 = const_cast<int *&>(prvalue<const int*>()); // expected-error {{const_cast from rvalue to reference type 'int *&'}} + X &ptr9 = const_cast<X&>(x); + X &ptrA = const_cast<X&>(xvalue<X>()); // expected-error {{const_cast from rvalue to reference type 'X &'}} + X &ptrB = const_cast<X&>(prvalue<X>()); // expected-error {{const_cast from rvalue to reference type 'X &'}} } struct A { |