FSF GCC merge 02/23/03
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.law / refs1.C
blobd53cdb41706374bc9478167a4320684d86487df9
1 // GROUPS passed references
2 // (Message bugs/refs:1)
3 // From: tal@vlsi.cs.caltech.edu
4 // Date:     Fri, 25 Feb 94 23:55:50 -0800
5 // Subject:  g++-2.5.8 produces incorrect code for references
6 // Message-ID: <9402260755.AA27693@vlsi.cs.caltech.edu>
8 #include <stdio.h>
10 class C {
11 private:
12    char** list;
13 public:
14    C(char** );
15    void count (int&);
18 C::C (char** l) {
19    list = l;
22 void C::count (int& total) {
23    if (*list == NULL)
24       return;
25    else {
26       list++;
27       count (++total); // THIS IS WHERE THE TROUBLE STARTS
28    }
31 char * foo[] = {
32    "one", "two", "three", NULL};
34 int main() {
35    C c(foo);
36    int i = 0;
37    c.count(i);
38    if (i == 3)
39      printf ("PASS\n");
40    else
41      { printf ("FAIL\n"); return 1; }