1 // Test the self-assignemnt detection plugin.
10 Foo() : a_(a_) {} // { dg-warning "assigned to itself" }
13 a_ = a_; // { dg-warning "assigned to itself" }
16 void operator=(Foo& rhs) {
26 int g = g; // { dg-warning "assigned to itself" }
27 Foo foo = foo; // { dg-warning "assigned to itself" }
33 int x = x; // { dg-warning "assigned to itself" }
34 static int y = y; // { dg-warning "assigned to itself" }
40 *f = *f; // { dg-warning "assigned to itself" }
41 bar1->b_ = bar1->b_; // { dg-warning "assigned to itself" }
42 bar2.c_ = bar2.c_; // { dg-warning "assigned to itself" }
43 local_foo = local_foo; // { dg-warning "assigned to itself" }
44 foo = foo; // { dg-warning "assigned to itself" }
46 bar_array[3].c_ = bar_array[3].c_; // { dg-warning "assigned to itself" }
47 bar_array[x+g].b_ = bar_array[x+g].b_; // { dg-warning "self-assignment detected" "" { xfail *-*-* } }