blob: 54123f2bb1938b39e61266ac181e081e5527d5ac (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
// g++ 1.37.1 bug 900514_03
// g++ fails to flag ERRORs on the following erroneous code.
// In Section 12.3.2 it says "Defining conversion by both a constructor and
// a conversion function can lead to ambiguities." However in the case below,
// the explicit cast syntax disambiguates the constructor as one which
// invokes the type conversion operator rather than the conversion.
// cfront 2.0 passes this test.
// keywords: user-defined type conversion operator, constructor
struct t_0_st_0;
struct t_0_st_1 {
int member;
t_0_st_1 (t_0_st_0&);// ERROR -
t_0_st_1 ();
};// ERROR -
struct t_0_st_0 {
int member;
operator t_0_st_1 ();// ERROR -
};
t_0_st_0 t_0_st_0_obj0;
void t_0_assignment ()
{
t_0_st_1 t_0_st_1_obj0;
t_0_st_1 t_0_st_1_obj1;
t_0_st_1 t_0_st_1_obj2;
t_0_st_1_obj0 = t_0_st_0_obj0; // ERROR - caught
t_0_st_1_obj1 = t_0_st_1 (t_0_st_0_obj0);
}
void t_0_local_init ()
{
t_0_st_1 t_0_st_1_obj0 = t_0_st_0_obj0; // ERROR -
t_0_st_1 t_0_st_1_obj1 = t_0_st_1 (t_0_st_0_obj0);
}
struct t_1_st_0;
struct t_1_st_1 {
int member;
t_1_st_1 (t_1_st_0&); // ERROR -
t_1_st_1 ();
void operator= (t_1_st_1&); // ERROR -
};
struct t_1_st_0 {
int member;
operator t_1_st_1 (); // ERROR -
};
t_1_st_0 t_1_st_0_obj0;
void t_1_assignment ()
{
t_1_st_1 t_1_st_1_obj0;
t_1_st_1 t_1_st_1_obj1;
t_1_st_1 t_1_st_1_obj2;
t_1_st_1_obj0 = t_1_st_0_obj0; // ERROR -
t_1_st_1_obj1 = t_1_st_1 (t_1_st_0_obj0); // ERROR -
}
void t_1_local_init ()
{
t_1_st_1 t_1_st_1_obj0 = t_1_st_0_obj0; // ERROR -
t_1_st_1 t_1_st_1_obj1 = t_1_st_1 (t_1_st_0_obj0);
}
struct t_2_st_0;
struct t_2_st_1 {
int member;
t_2_st_1 (t_2_st_0); // ERROR - candidate
t_2_st_1 ();
}; // ERROR - candidate
struct t_2_st_0 {
int member;
operator t_2_st_1 (); // ERROR - candidate
};
t_2_st_0 t_2_st_0_obj0;
void t_2_assignment ()
{
t_2_st_1 t_2_st_1_obj0;
t_2_st_1 t_2_st_1_obj1;
t_2_st_1 t_2_st_1_obj2;
t_2_st_1_obj0 = t_2_st_0_obj0; // ERROR - caught
t_2_st_1_obj1 = t_2_st_1 (t_2_st_0_obj0);
}
void t_2_local_init ()
{
t_2_st_1 t_2_st_1_obj0 = t_2_st_0_obj0; // ERROR -
t_2_st_1 t_2_st_1_obj1 = t_2_st_1 (t_2_st_0_obj0);
}
|