1 // RUN: %clang_cc1 -std=c++98 %s -Wdeprecated -verify -triple x86_64-linux-gnu 2 // RUN: %clang_cc1 -std=c++11 %s -Wdeprecated -verify -triple x86_64-linux-gnu 3 // RUN: %clang_cc1 -std=c++1y %s -Wdeprecated -verify -triple x86_64-linux-gnu 4 5 // RUN: %clang_cc1 -std=c++1y %s -Wdeprecated -verify -triple x86_64-linux-gnu -Wno-deprecated-register -DNO_DEPRECATED_FLAGS 6 7 #include "Inputs/register.h" 8 9 void f() throw(); 10 void g() throw(int); 11 void h() throw(...); 12 #if __cplusplus >= 201103L 13 // expected-warning@-4 {{dynamic exception specifications are deprecated}} expected-note@-4 {{use 'noexcept' instead}} 14 // expected-warning@-4 {{dynamic exception specifications are deprecated}} expected-note@-4 {{use 'noexcept(false)' instead}} 15 // expected-warning@-4 {{dynamic exception specifications are deprecated}} expected-note@-4 {{use 'noexcept(false)' instead}} 16 #endif 17 18 void stuff() { 19 register int n; 20 #if __cplusplus >= 201103L && !defined(NO_DEPRECATED_FLAGS) 21 // expected-warning@-2 {{'register' storage class specifier is deprecated}} 22 #endif 23 24 register int m asm("rbx"); // no-warning 25 26 int k = to_int(n); // no-warning 27 28 bool b; 29 ++b; // expected-warning {{incrementing expression of type bool is deprecated}} 30 31 // FIXME: This is ill-formed in C++11. 32 char *p = "foo"; // expected-warning {{conversion from string literal to 'char *' is deprecated}} 33 } 34 35 struct S { int n; }; 36 struct T : private S { 37 S::n; 38 #if __cplusplus < 201103L 39 // expected-warning@-2 {{access declarations are deprecated; use using declarations instead}} 40 #else 41 // expected-error@-4 {{ISO C++11 does not allow access declarations; use using declarations instead}} 42 #endif 43 }; 44 45 #if __cplusplus >= 201103L 46 namespace DeprecatedCopy { 47 struct Assign { 48 Assign &operator=(const Assign&); // expected-warning {{definition of implicit copy constructor for 'Assign' is deprecated because it has a user-declared copy assignment operator}} 49 }; 50 Assign a1, a2(a1); // expected-note {{implicit copy constructor for 'Assign' first required here}} 51 52 struct Ctor { 53 Ctor(); 54 Ctor(const Ctor&); // expected-warning {{definition of implicit copy assignment operator for 'Ctor' is deprecated because it has a user-declared copy constructor}} 55 }; 56 Ctor b1, b2; 57 void f() { b1 = b2; } // expected-note {{implicit copy assignment operator for 'Ctor' first required here}} 58 59 struct Dtor { 60 ~Dtor(); 61 // expected-warning@-1 {{definition of implicit copy constructor for 'Dtor' is deprecated because it has a user-declared destructor}} 62 // expected-warning@-2 {{definition of implicit copy assignment operator for 'Dtor' is deprecated because it has a user-declared destructor}} 63 }; 64 Dtor c1, c2(c1); // expected-note {{implicit copy constructor for 'Dtor' first required here}} 65 void g() { c1 = c2; } // expected-note {{implicit copy assignment operator for 'Dtor' first required here}} 66 } 67 #endif 68