gcc/testsuite/g++.dg/warn/Winit-self-3.C
raw| 1 | // PR c++/64667 |
| 2 | // { dg-options "-Winit-self" } |
| 3 | |
| 4 | class A |
| 5 | { |
| 6 | public: |
| 7 | A(const A&) : a(a) {} // { dg-warning "initialized with itself" } |
| 8 | private: |
| 9 | int a; |
| 10 | }; |
| 11 | |
| 12 | class B |
| 13 | { |
| 14 | public: |
| 15 | B(const B&) : b(b) {} // { dg-warning "initialized with itself" } |
| 16 | private: |
| 17 | int* b; |
| 18 | }; |
| 19 | |
| 20 | class C |
| 21 | { |
| 22 | public: |
| 23 | C(const C&) : c(c) {} // { dg-warning "initialized with itself" } |
| 24 | private: |
| 25 | int& c; |
| 26 | }; |