1/* This doesn't work on solaris2 for reasons described in PR 6482.  */
2/* { dg-do run { xfail *-*-solaris2* } } */
3#include <stdlib.h>
4
5class Two {
6private:
7    int i, j, k;
8public:
9    static int count;
10    Two( int ii, int jj ) { i = ii; j = jj; k = count++; };
11    Two( void )           { i =  0; j =  0; k = count++; };
12    int eye( void ) { return i; };
13    int jay( void ) { return j; };
14    int kay( void ) { return k; };
15};
16
17extern Two foo;
18extern Two goo;
19extern Two coo[];
20extern Two koo[];
21
22Two foo __attribute__((init_priority(1005))) ( 5, 6 );
23
24Two goo __attribute__((init_priority(1007))) = Two( 7, 8 );
25
26Two doo[ 3 ];
27
28Two hoo[ 3 ] = {
29    Two( 11, 12 ),
30    Two( 13, 14 ),
31    Two( 15, 16 )
32};
33
34Two coo[ 3 ] __attribute__((init_priority(1000)));
35
36Two koo[ 3 ] __attribute__((init_priority(1000))) = {
37    Two( 21, 22 ),
38    Two( 23, 24 ),
39    Two( 25, 26 )
40};
41
42Two xoo[ 3 ] __attribute__((init_priority(1100)));
43
44Two zoo[ 3 ] __attribute__((init_priority(1100))) = {
45    Two( 31, 32 ),
46    Two( 33, 34 ),
47    Two( 35, 36 )
48};
49
50int Two::count;
51
52long x = 0;
53
54#define X( n ) \
55  do { if ( x & (1L << (n)) ) return 1; else x |= (1L << (n)); } while (0)
56
57int main()
58{
59
60    X( coo[0].kay() );
61    X( coo[1].kay() );
62    X( coo[2].kay() );
63    X( koo[0].kay() );
64    X( koo[1].kay() );
65    X( koo[2].kay() );
66    if ( 0x3f != x ) abort ();
67
68    X( foo.kay() );
69    if ( 0x7f != x ) abort ();
70
71    X( goo.kay() );
72    if ( 0xff != x ) abort ();
73
74    X( xoo[0].kay() );
75    X( xoo[1].kay() );
76    X( xoo[2].kay() );
77    X( zoo[0].kay() );
78    X( zoo[1].kay() );
79    X( zoo[2].kay() );
80    if ( 0x3fff != x ) abort ();
81
82    X( doo[0].kay() );
83    X( doo[1].kay() );
84    X( doo[2].kay() );
85    X( hoo[0].kay() );
86    X( hoo[1].kay() );
87    X( hoo[2].kay() );
88    if ( 0xfffff != x ) abort ();
89
90    exit (0);
91}
92