summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/plugin/dumb-plugin-test-1.C
blob: 70101c86826e198d49c2417dbb563c476967a2ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Test case for the dumb plugin.
// { dg-do compile }
// { dg-options "-O -fplugin-arg-dumb_plugin-ref-pass-name=ccp -fplugin-arg-dumb_plugin-ref-pass-instance-num=1" }

class Foo {
 private:
  int a_;

 public:
  Foo() : a_(a_) {} // { dg-warning "Before genericizing function" }

  void setA(int a) {
    a_ = a_;
  } // { dg-warning "Before genericizing function" }

  void operator=(Foo& rhs) {
    this->a_ = rhs.a_;
  } // { dg-warning "Before genericizing function" }
}; // { dg-warning "Process struct Foo" }

struct Bar {
  int b_;
  int c_;
}; // { dg-warning "Process struct Bar" }

int g = g;
Foo foo = foo;

int func()
{
  Bar *bar1, bar2;
  Foo local_foo;
  int x = x;
  static int y = y;
  float *f;
  Bar bar_array[5];
  char n;
  int overflow;

  *f = *f;
  bar1->b_ = bar1->b_;
  bar2.c_ = bar2.c_;
  local_foo = local_foo;
  foo = foo;
  foo.setA(5);
  bar_array[3].c_ = bar_array[3].c_;
  bar_array[x+g].b_ = bar_array[x+g].b_;
  y = x;
  x = y;
} // { dg-warning "Before genericizing function" }

// { dg-warning "Analyze function" "" { target *-*-* } 50 }
// { dg-warning "End of compilation unit" "" { target *-*-* } 50 }