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; void operator+(int); }; 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 S::operator+; 47 #if __cplusplus < 201103L 48 // expected-warning@-2 {{access declarations are deprecated; use using declarations instead}} 49 #else 50 // expected-error@-4 {{ISO C++11 does not allow access declarations; use using declarations instead}} 51 #endif 52 }; 53 54 #if __cplusplus >= 201103L 55 namespace DeprecatedCopy { 56 struct Assign { 57 Assign &operator=(const Assign&); // expected-warning {{definition of implicit copy constructor for 'Assign' is deprecated because it has a user-declared copy assignment operator}} 58 }; 59 Assign a1, a2(a1); // expected-note {{implicit copy constructor for 'Assign' first required here}} 60 61 struct Ctor { 62 Ctor(); 63 Ctor(const Ctor&); // expected-warning {{definition of implicit copy assignment operator for 'Ctor' is deprecated because it has a user-declared copy constructor}} 64 }; 65 Ctor b1, b2; 66 void f() { b1 = b2; } // expected-note {{implicit copy assignment operator for 'Ctor' first required here}} 67 68 struct Dtor { 69 ~Dtor(); 70 // expected-warning@-1 {{definition of implicit copy constructor for 'Dtor' is deprecated because it has a user-declared destructor}} 71 // expected-warning@-2 {{definition of implicit copy assignment operator for 'Dtor' is deprecated because it has a user-declared destructor}} 72 }; 73 Dtor c1, c2(c1); // expected-note {{implicit copy constructor for 'Dtor' first required here}} 74 void g() { c1 = c2; } // expected-note {{implicit copy assignment operator for 'Dtor' first required here}} 75 } 76 #endif 77