1 // RUN: %clang_cc1 -std=c++11 %s -Wdeprecated-copy -verify
2 // RUN: %clang_cc1 -std=c++11 %s -Wdeprecated-copy-dtor -DDEPRECATED_COPY_DTOR -verify
3 // RUN: %clang_cc1 -std=c++11 %s -Wextra -verify
4 
5 #ifdef DEPRECATED_COPY_DTOR
6 struct A {
7   int *ptr;
~AA8   ~A() { delete ptr; } // expected-warning {{definition of implicit copy constructor for 'A' is deprecated because it has a user-declared destructor}}
9 };
10 
foo()11 void foo() {
12   A a{};
13   A b = a; // expected-note {{implicit copy constructor for 'A' first required here}}
14 }
15 #else
16 struct B {
17   B &operator=(const B &); // expected-warning {{definition of implicit copy constructor for 'B' is deprecated because it has a user-declared copy assignment operator}}
18 };
19 
bar()20 void bar() {
21   B b1, b2(b1); // expected-note {{implicit copy constructor for 'B' first required here}}
22 }
23 #endif
24