[C++ PATCH] Deprecate -ffriend-injection
[official-gcc.git] / gcc / testsuite / g++.dg / tree-ssa / copyprop-1.C
blob34a9f7b225b22d480d006d86387b3b9179634b08
1 /* { dg-do compile } */
2 /* { dg-options "-O -fdump-tree-dce3" } */
4 /* Verify that we can eliminate the useless conversions to/from
5    const qualified pointer types
6      this_2 = o_1;
7      D.20003_4 = this_2->data_m;
8      this_5 = D.20003_4;
9      D.20005_6 = this_5->value;
10    copyprop should propagate o_1 and D.20003_4 to the loads of data_m
11    and value.  dce removes all traces of this.  */
13 struct Data {
14   int get() const { return value; }
15   int value;
18 struct Object {
19   int operator[](int i) const { return data_m->get(); }
20   Data *data_m;
23 int foo(Object&o)
25   return o[0];
28 /* Remaining should be two loads.  */
30 /* { dg-final { scan-tree-dump-times " = \[^\n\]*;" 2 "dce3" } } */