Debian Codegraph @

gcc/testsuite/g++.old-deja/g++.brendan/redecl2.C

raw
1 // { dg-do run }
2 // GROUPS passed redeclaration
3 // Check that if multiple declarations of the same single
4 // function are present in different places in the same file,
5 // and if these declarations differ (as allowed) in the number
6 // of argument defaults provided, that correct values are
7 // passed at all call points anyway.
8
9 extern "C" int printf (const char *, ...);
10
11 void receiver (int ii, int jj);
12
13 void sender_1 ()
14 {
15 receiver (3,7);
16 }
17
18 void receiver (int ii, int jj = 9);
19
20 void sender_2 ()
21 {
22 receiver (5);
23 }
24
25 int ii_sum = 0;
26 int jj_sum = 0;
27
28 void sender_3 ();
29
30 int main ()
31 {
32 sender_1 ();
33 sender_2 ();
34 sender_3 ();
35 if (ii_sum != 13 || jj_sum != 25)
36 { printf ("FAIL\n"); return 1; }
37 else
38 printf ("PASS\n");
39
40 return 0;
41 }
42
43 void receiver (int ii, int jj)
44 {
45 ii_sum += ii;
46 jj_sum += jj;
47 }
48
49 void sender_3 ()
50 {
51 receiver (5);
52 }