summaryrefslogtreecommitdiffstats
path: root/gcc/testsuite/g++.old-deja/g++.gb/sig08.C
blob: 2d5d14d997084d95129be9bfb5e327ac20d5732d (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
// Special g++ Options: -fhandle-signatures
// GROUPS passed gb sigptr argument return-value
// Test passing a signature pointer to a function and returning it from one.

extern "C"
{
  int printf (char *, ...);
}

class C
{
public:
  char * text;
  char * get_msg (void) const { return text; }
};

const C a = { "PA" };
const C b = { "SS" };

signature S
{
  char * get_msg (void) const;
};

char * f (const S * p)
{
  return p->get_msg ();
}

const S * g (const C * p)
{
  return p;
}

int main (void)
{
  printf ("%s%s\n", f(&a), g(&b)->get_msg ());

  return 0;
}
OpenPOWER on IntegriCloud