libstdc++: Define __glibcxx_assert_fail for non-verbose build [PR115585]
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.law / refs1.C
blobd6dd21c272451b36130c68472fafaf9db0aaf5cf
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>
9 #include <stdio.h>
11 class C {
12 private:
13    const char** list;
14 public:
15    C(const char** );
16    void count (int&);
19 C::C (const char** l) {
20    list = l;
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    }
32 const char * foo[] = {
33    "one", "two", "three", NULL};
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; }