aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/lto/pr82027_0.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/lto/pr82027_0.C')
-rw-r--r--gcc/testsuite/g++.dg/lto/pr82027_0.C73
1 files changed, 73 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/lto/pr82027_0.C b/gcc/testsuite/g++.dg/lto/pr82027_0.C
new file mode 100644
index 00000000000..70cc776b2db
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/pr82027_0.C
@@ -0,0 +1,73 @@
+// { dg-lto-do run }
+// { dg-lto-options { { -O3 -flto } } }
+
+class Position
+{
+ public:
+ Position( void ) {}
+ virtual ~Position() {}
+
+ virtual void calcPercent( const char *name,int pos,int size ) {}
+};
+
+
+class Looper
+{
+ public:
+ Looper( Position *cc,int size )
+ : m_cc(cc), m_size(size) {}
+ virtual ~Looper() {}
+
+ void loop( void )
+ {
+ for( int pos=0; pos<m_size; pos++ )
+ {
+ m_cc->calcPercent( "",pos,m_size );
+ }
+ }
+
+ private:
+ Position *m_cc;
+ int m_size;
+};
+
+
+class EmptyClass
+{
+ public:
+ EmptyClass( void ) {}
+ virtual ~EmptyClass() {}
+};
+
+
+class Combined : public EmptyClass, public Position
+{
+ public:
+ Combined( void ) : m_percent(0) {}
+ ~Combined() {}
+
+ void calcPercent( const char *name,int pos,int size )
+ {
+ int percent = 100*pos/size;
+ if( percent!=m_percent )
+ m_percent = percent;
+ }
+
+ private:
+ int m_percent;
+};
+
+
+
+int main( int argc,char **argv )
+{
+ Combined *comb = new Combined();
+ Looper *looper = new Looper( comb,argc );
+
+ looper->loop();
+
+ delete comb;
+ delete looper;
+
+ return( 0 );
+}