1 // Build don't link:
2 // GROUPS passed arg-matching
3 // arg-matching file
4 // Message-Id: <199405132049.QAA06835@elan.cs.UMD.EDU>
5 // Subject: Bug in g++ 2.4.5 and 2.5.8
6 // Date: Fri, 13 May 1994 16:49:22 -0400
7 // From: Evan Rosser <ejr@cs.umd.edu>
8 
9 #include <assert.h>
10 #include <stdio.h>
11 #include <stdlib.h>
12 
13 class TupleIterator {
14 public:
15     TupleIterator(int *tpl);
16     int& operator*();
17     int  live() const;
18 // The compile fails with "no post-increment operator for type" at "TI++"
19 // below.
20 // It succeeds with the same declarations if set_position does not take an int.
21 // This occurs with G++ 2.4.5 and 2.5.8.
22 // Sun CC works OK with either case.
23         void operator++(int);
24         void set_position(int);
25 private:
26 };
27 
main()28 int main() {
29 
30 int t[5];
31 t[1] = 1; t[2] = 2;t[3] = 3;t[4] = 4;
32 TupleIterator TI(t);
33 
34     while(TI.live()){
35         printf("%d", *TI);
36         TI++;
37     }
38 }
39 
40