]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/g++.old-deja/g++.law/refs1.C
extern2.cc (foo): Declare as of type cost char*.
[thirdparty/gcc.git] / gcc / testsuite / g++.old-deja / g++.law / refs1.C
1 // { dg-do run }
2 // GROUPS passed references
3 // (Message bugs/refs:1)
4 // From: tal@vlsi.cs.caltech.edu
5 // Date: Fri, 25 Feb 94 23:55:50 -0800
6 // Subject: g++-2.5.8 produces incorrect code for references
7 // Message-ID: <9402260755.AA27693@vlsi.cs.caltech.edu>
8
9 #include <stdio.h>
10
11 class C {
12 private:
13 const char** list;
14 public:
15 C(const char** );
16 void count (int&);
17 };
18
19 C::C (const char** l) {
20 list = l;
21 }
22
23 void C::count (int& total) {
24 if (*list == NULL)
25 return;
26 else {
27 list++;
28 count (++total); // THIS IS WHERE THE TROUBLE STARTS
29 }
30 }
31
32 const char * foo[] = {
33 "one", "two", "three", NULL};
34
35 int main() {
36 C c(foo);
37 int i = 0;
38 c.count(i);
39 if (i == 3)
40 printf ("PASS\n");
41 else
42 { printf ("FAIL\n"); return 1; }
43 }