OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.old-deja/] [g++.law/] [ctors12.C] - Blame information for rev 779

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 305 jeremybenn
// { dg-do run  }
2
// GROUPS passed constructors
3
#include 
4
#include 
5
#include 
6
 
7
#define MAGIC 7654
8
 
9
class complex {
10
        double re;
11
        double im;
12
        int magic;
13
        static int count;
14
public:
15
        complex() { re=im=0; magic=MAGIC; }
16
        complex(double d) { re=d; im=0; magic=MAGIC; }
17
        complex(double d, double d2) {re=d; im=d2; magic=MAGIC; }
18
        ~complex() {if(magic!=MAGIC) {std::printf("FAIL\n"); std::exit(1);}}
19
        friend std::ostream& operator << (std::ostream& o, const complex& c)
20
        { return o << "(" << c.re << "," << c.im << ")"; }
21
};
22
 
23
int complex::count=0;
24
 
25
int main()
26
{
27
        complex v[6] = {1, complex(1,2), complex(), 2 }; // ARM Sect. 12.6.1
28
        int i;                                           // page 289
29
 
30
        for(i=0; i<6; i++) ;
31
        std::printf ("PASS\n");
32
 
33
        return 0;
34
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.