2018-11-07 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / g++.dg / lto / pr82027_0.C
blob70cc776b2db96a0c04e186a133bd335f4b71c230
1 // { dg-lto-do run }
2 // { dg-lto-options { { -O3 -flto } } }
4 class Position
6   public:
7     Position( void ) {}
8     virtual ~Position() {}
10     virtual void calcPercent( const char *name,int pos,int size ) {}
14 class Looper
16   public:
17     Looper( Position *cc,int size )
18       : m_cc(cc), m_size(size) {}
19     virtual ~Looper() {}
21     void loop( void )
22     {
23       for( int pos=0; pos<m_size; pos++ )
24       {
25         m_cc->calcPercent( "",pos,m_size );
26       }
27     }
29   private:
30     Position *m_cc;
31     int m_size;
35 class EmptyClass
37   public:
38     EmptyClass( void ) {}
39     virtual ~EmptyClass() {}
43 class Combined : public EmptyClass, public Position
45   public:
46     Combined( void ) : m_percent(0) {}
47     ~Combined() {}
49     void calcPercent( const char *name,int pos,int size )
50     {
51       int percent = 100*pos/size;
52       if( percent!=m_percent )
53         m_percent = percent;
54     }
56   private:
57     int m_percent;
62 int main( int argc,char **argv )
64   Combined *comb = new Combined();
65   Looper *looper = new Looper( comb,argc );
67   looper->loop();
69   delete comb;
70   delete looper;
72   return( 0 );