summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.benjamin/friend01.C
blob: b203bc56a68d4bdfeb609958a3f5ad181cdc73c2 (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
// { dg-do assemble  }
//980610 bkoz
// example 1: buggy

class foo {
public:
    class bar;
    int func(bar *);
    class bar {
        int st;
    public:
        bar(){st=12;}
        ~bar(){}
        friend int foo::func(bar *);
    };
    foo(){}
    ~foo(){}
};


int foo::func(bar *obj) {
  obj->st++;
  return (obj->st);
}

void test02() {
  foo obj_f;
  foo::bar obj_b;
  
  obj_f.func( &obj_b);
}