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 bool b; 28 ++b; // expected-warning {{incrementing expression of type bool is deprecated}} 29 30 char *p = "foo"; 31 #if __cplusplus < 201103L 32 // expected-warning@-2 {{conversion from string literal to 'char *' is deprecated}} 33 #else 34 // expected-warning@-4 {{ISO C++11 does not allow conversion from string literal to 'char *'}} 35 #endif 36 } 37 38 struct S { int n; }; 39 struct T : private S { 40 S::n; 41 #if __cplusplus < 201103L 42 // expected-warning@-2 {{access declarations are deprecated; use using declarations instead}} 43 #else 44 // expected-error@-4 {{ISO C++11 does not allow access declarations; use using declarations instead}} 45 #endif 46 }; 47 48 #if __cplusplus >= 201103L 49 namespace DeprecatedCopy { 50 struct Assign { 51 Assign &operator=(const Assign&); // expected-warning {{definition of implicit copy constructor for 'Assign' is deprecated because it has a user-declared copy assignment operator}} 52 }; 53 Assign a1, a2(a1); // expected-note {{implicit copy constructor for 'Assign' first required here}} 54 55 struct Ctor { 56 Ctor(); 57 Ctor(const Ctor&); // expected-warning {{definition of implicit copy assignment operator for 'Ctor' is deprecated because it has a user-declared copy constructor}} 58 }; 59 Ctor b1, b2; 60 void f() { b1 = b2; } // expected-note {{implicit copy assignment operator for 'Ctor' first required here}} 61 62 struct Dtor { 63 ~Dtor(); 64 // expected-warning@-1 {{definition of implicit copy constructor for 'Dtor' is deprecated because it has a user-declared destructor}} 65 // expected-warning@-2 {{definition of implicit copy assignment operator for 'Dtor' is deprecated because it has a user-declared destructor}} 66 }; 67 Dtor c1, c2(c1); // expected-note {{implicit copy constructor for 'Dtor' first required here}} 68 void g() { c1 = c2; } // expected-note {{implicit copy assignment operator for 'Dtor' first required here}} 69 } 70 #endif 71