Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/g++.dg/lto/pr82027_0.C @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
111:04ced10e8804 | 131:84e7813d76e9 |
---|---|
1 // { dg-lto-do run } | |
2 // { dg-lto-options { { -O3 -flto } } } | |
3 | |
4 class Position | |
5 { | |
6 public: | |
7 Position( void ) {} | |
8 virtual ~Position() {} | |
9 | |
10 virtual void calcPercent( const char *name,int pos,int size ) {} | |
11 }; | |
12 | |
13 | |
14 class Looper | |
15 { | |
16 public: | |
17 Looper( Position *cc,int size ) | |
18 : m_cc(cc), m_size(size) {} | |
19 virtual ~Looper() {} | |
20 | |
21 void loop( void ) | |
22 { | |
23 for( int pos=0; pos<m_size; pos++ ) | |
24 { | |
25 m_cc->calcPercent( "",pos,m_size ); | |
26 } | |
27 } | |
28 | |
29 private: | |
30 Position *m_cc; | |
31 int m_size; | |
32 }; | |
33 | |
34 | |
35 class EmptyClass | |
36 { | |
37 public: | |
38 EmptyClass( void ) {} | |
39 virtual ~EmptyClass() {} | |
40 }; | |
41 | |
42 | |
43 class Combined : public EmptyClass, public Position | |
44 { | |
45 public: | |
46 Combined( void ) : m_percent(0) {} | |
47 ~Combined() {} | |
48 | |
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 } | |
55 | |
56 private: | |
57 int m_percent; | |
58 }; | |
59 | |
60 | |
61 | |
62 int main( int argc,char **argv ) | |
63 { | |
64 Combined *comb = new Combined(); | |
65 Looper *looper = new Looper( comb,argc ); | |
66 | |
67 looper->loop(); | |
68 | |
69 delete comb; | |
70 delete looper; | |
71 | |
72 return( 0 ); | |
73 } |