OSDN Git Service

PR c++/47687
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / ipa / pr45572-1.C
1 // { dg-do compile }
2 // { dg-options "-finline-small-functions -findirect-inlining -finline-functions -O" }
3
4 extern "C" {
5 typedef long unsigned int size_t;
6 typedef long int __ssize_t;
7 typedef struct _IO_FILE FILE;
8 typedef struct
9 {
10 } __mbstate_t;
11 extern __inline __attribute__ ((__gnu_inline__)) int
12 fgetc_unlocked (FILE *__fp)
13 {
14 }
15 extern __inline __attribute__ ((__gnu_inline__)) int
16 putc_unlocked (int __c, FILE *__stream)
17 {
18 }
19 extern __inline __attribute__ ((__gnu_inline__)) __ssize_t
20 getline (char **__lineptr, size_t *__n, FILE *__stream)
21 {
22 }
23 extern __inline __attribute__ ((__gnu_inline__)) int
24 ferror_unlocked (FILE *__stream) throw ()
25 {
26 }
27 }
28 typedef struct
29 {} __mpf_struct;
30 typedef __mpf_struct mpf_t[1];
31 typedef const __mpf_struct *mpf_srcptr;
32 typedef __mpf_struct *mpf_ptr;
33 extern "C" {
34  void __gmpf_add (mpf_ptr, mpf_srcptr, mpf_srcptr);
35 }
36 class _knumber
37 {
38  public:
39   enum NumType {SpecialType, IntegerType, FractionType, FloatType};
40   virtual NumType type(void) const = 0;
41   virtual _knumber * add(_knumber const & arg2) const = 0;
42   virtual operator long int(void) const = 0;
43 };
44 class _knumfloat : public _knumber
45 {
46   _knumfloat(double num = 1.0)
47   ;
48   virtual NumType type(void) const ;
49   virtual _knumber * add(_knumber const & arg2) const;
50   virtual operator long int (void) const;
51     mpf_t _mpf;
52 };
53 _knumber *_knumfloat::add(_knumber const & arg2) const
54 {
55   if (arg2.type() == SpecialType)
56     return arg2.add(*this);
57 {
58     _knumfloat tmp_num(arg2);
59     return tmp_num.add(*this);
60   }
61   _knumfloat * tmp_num = new _knumfloat();
62   __gmpf_add(tmp_num->_mpf, _mpf,
63    dynamic_cast<_knumfloat const &>(arg2)._mpf);
64 }