diff options
Diffstat (limited to 'test/SemaCXX')
-rw-r--r-- | test/SemaCXX/address-of.cpp | 6 | ||||
-rw-r--r-- | test/SemaCXX/conditional-expr.cpp | 4 | ||||
-rw-r--r-- | test/SemaCXX/cxx0x-initializer-aggregates.cpp | 5 | ||||
-rw-r--r-- | test/SemaCXX/nullptr.cpp | 2 |
4 files changed, 11 insertions, 6 deletions
diff --git a/test/SemaCXX/address-of.cpp b/test/SemaCXX/address-of.cpp index 677dc8966b..373e44c17e 100644 --- a/test/SemaCXX/address-of.cpp +++ b/test/SemaCXX/address-of.cpp @@ -22,12 +22,12 @@ enum E { }; void test() { - (void)&Enumerator; // expected-error{{address expression must be an lvalue or a function designator}} + (void)&Enumerator; // expected-error{{cannot take the address of an rvalue of type 'E'}} } template<int N> void test2() { - (void)&N; // expected-error{{address expression must be an lvalue or a function designator}} + (void)&N; // expected-error{{cannot take the address of an rvalue of type 'int'}} } // PR clang/3222 @@ -41,7 +41,7 @@ struct PR11066 { }; void PR11066::test() { - int (PR11066::*ptr)(int) = & &PR11066::foo; // expected-error{{address expression must be an lvalue or a function designator}} + int (PR11066::*ptr)(int) = & &PR11066::foo; // expected-error{{extra '&' taking address of overloaded function}} } namespace test3 { diff --git a/test/SemaCXX/conditional-expr.cpp b/test/SemaCXX/conditional-expr.cpp index 7595f1dfa1..692aaefc9d 100644 --- a/test/SemaCXX/conditional-expr.cpp +++ b/test/SemaCXX/conditional-expr.cpp @@ -146,7 +146,7 @@ void test() (void)(i1 ? 1 : Ambig()); // expected-error {{conversion from 'Ambig' to 'int' is ambiguous}} (void)(i1 ? Ambig() : 1); // expected-error {{conversion from 'Ambig' to 'int' is ambiguous}} // By the way, this isn't an lvalue: - &(i1 ? i1 : i2); // expected-error {{address expression must be an lvalue or a function designator}} + &(i1 ? i1 : i2); // expected-error {{cannot take the address of an rvalue}} // p4 (lvalue, same type) Fields flds; @@ -183,7 +183,7 @@ void test() i1 ? &MixedFields::ci : &MixedFields::cvi; (void)(i1 ? &MixedFields::ci : &MixedFields::vi); // Conversion of primitives does not result in an lvalue. - &(i1 ? i1 : d1); // expected-error {{address expression must be an lvalue or a function designator}} + &(i1 ? i1 : d1); // expected-error {{cannot take the address of an rvalue}} (void)&(i1 ? flds.b1 : flds.i1); // expected-error {{address of bit-field requested}} (void)&(i1 ? flds.i1 : flds.b1); // expected-error {{address of bit-field requested}} diff --git a/test/SemaCXX/cxx0x-initializer-aggregates.cpp b/test/SemaCXX/cxx0x-initializer-aggregates.cpp index 7d1fa7e3ec..f53ac6dff9 100644 --- a/test/SemaCXX/cxx0x-initializer-aggregates.cpp +++ b/test/SemaCXX/cxx0x-initializer-aggregates.cpp @@ -125,3 +125,8 @@ namespace multidimensional_array { g({{1,2},{3,4}}); } } + +namespace array_addressof { + using T = int[5]; + T *p = &T{1,2,3,4,5}; // expected-error {{taking the address of a temporary object of type 'T' (aka 'int [5]')}} +} diff --git a/test/SemaCXX/nullptr.cpp b/test/SemaCXX/nullptr.cpp index d148f76698..b49f63b980 100644 --- a/test/SemaCXX/nullptr.cpp +++ b/test/SemaCXX/nullptr.cpp @@ -57,7 +57,7 @@ nullptr_t f(nullptr_t null) o2(nullptr); // expected-error {{ambiguous}} // nullptr is an rvalue, null is an lvalue - (void)&nullptr; // expected-error {{address expression must be an lvalue}} + (void)&nullptr; // expected-error {{cannot take the address of an rvalue of type 'nullptr_t'}} nullptr_t *pn = &null; // You can reinterpret_cast nullptr to an integer. |