Annotation of researchv10dc/cmd/cfront/ooptcfront/demo/deletion.c, revision 1.1.1.1

1.1       root        1: #include "check.h"
                      2: 
                      3: int count = 0 ;
                      4: 
                      5: class small
                      6: { public:
                      7:        int foo;
                      8:        small(){};
                      9:        ~small(){count++ ;};
                     10: };
                     11: 
                     12: class big
                     13: { public:
                     14:        int foo;
                     15:        small contained;
                     16:        big(){};
                     17:        ~big(){count++;} ;
                     18: };
                     19: 
                     20: template<class contained_type> class para
                     21: { public:
                     22:        int foo;
                     23:        contained_type contained;
                     24:        para(){};
                     25:        ~para(){count++;} ;
                     26: };
                     27: 
                     28: typedef para<small> ct;
                     29: 
                     30: template<class contained_type> class para2
                     31: { public:
                     32:        int foo;
                     33:        contained_type contained;
                     34:        para2(){};
                     35:        ~para2(){count++;} ;
                     36: };
                     37: 
                     38: 
                     39: main()
                     40: {
                     41:   start_test(__FILE__) ;
                     42: 
                     43:   {
                     44:     small s;
                     45:   }
                     46:   check(count == 1) ;
                     47:   count = 0 ;
                     48:   {
                     49:     big b;
                     50:   }
                     51:   check(count == 2) ;
                     52:   count = 0 ;
                     53: 
                     54:   {
                     55:     para<small> p;
                     56:   }
                     57:   check(count == 2);
                     58:   count = 0 ;
                     59:   
                     60:   {
                     61:     para2<ct> p2;
                     62:   }
                     63:   check (count == 3) ;
                     64: 
                     65:   end_test() ;
                     66:   
                     67: };

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.