blob: b69dcb09dd2a0779730118375947afcc5f7641d7 [file] [log] [blame]
Richard Smith79f4bb72013-06-13 02:02:51 +00001// RUN: %clang_cc1 -std=c++98 %s -Wdeprecated -verify
2// RUN: %clang_cc1 -std=c++11 %s -Wdeprecated -verify
3// RUN: %clang_cc1 -std=c++1y %s -Wdeprecated -verify
4
5void f() throw();
6void g() throw(int);
7void h() throw(...);
8#if __cplusplus >= 201103L
9// expected-warning@-4 {{dynamic exception specifications are deprecated}} expected-note@-4 {{use 'noexcept' instead}}
10// expected-warning@-4 {{dynamic exception specifications are deprecated}} expected-note@-4 {{use 'noexcept(false)' instead}}
11// expected-warning@-4 {{dynamic exception specifications are deprecated}} expected-note@-4 {{use 'noexcept(false)' instead}}
12#endif
13
14void stuff() {
15 register int n;
16#if __cplusplus >= 201103L
17 // expected-warning@-2 {{'register' storage class specifier is deprecated}}
18#endif
19
20 bool b;
21 ++b; // expected-warning {{incrementing expression of type bool is deprecated}}
22
23 // FIXME: This is ill-formed in C++11.
24 char *p = "foo"; // expected-warning {{conversion from string literal to 'char *' is deprecated}}
25}
26
27struct S { int n; };
28struct T : private S {
Richard Smith1b2209f2013-06-13 02:12:17 +000029 S::n;
30#if __cplusplus < 201103L
31 // expected-warning@-2 {{access declarations are deprecated; use using declarations instead}}
32#else
33 // expected-error@-4 {{ISO C++11 does not allow access declarations; use using declarations instead}}
34#endif
Richard Smith79f4bb72013-06-13 02:02:51 +000035};
Richard Smith36155c12013-06-13 03:23:42 +000036
37#if __cplusplus >= 201103L
38namespace DeprecatedCopy {
39 struct Assign {
40 Assign &operator=(const Assign&); // expected-warning {{definition of implicit copy constructor for 'Assign' is deprecated because it has a user-declared copy assignment operator}}
41 };
42 Assign a1, a2(a1); // expected-note {{implicit default copy constructor for 'Assign' first required here}}
43
44 struct Ctor {
45 Ctor();
46 Ctor(const Ctor&); // expected-warning {{definition of implicit copy assignment operator for 'Ctor' is deprecated because it has a user-declared copy constructor}}
47 };
48 Ctor b1, b2;
49 void f() { b1 = b2; } // expected-note {{implicit default copy assignment operator for 'Ctor' first required here}}
50
51 struct Dtor {
52 ~Dtor();
53 // expected-warning@-1 {{definition of implicit copy constructor for 'Dtor' is deprecated because it has a user-declared destructor}}
54 // expected-warning@-2 {{definition of implicit copy assignment operator for 'Dtor' is deprecated because it has a user-declared destructor}}
55 };
56 Dtor c1, c2(c1); // expected-note {{implicit default copy constructor for 'Dtor' first required here}}
57 void g() { c1 = c2; } // expected-note {{implicit default copy assignment operator for 'Dtor' first required here}}
58}
59#endif