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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.old-deja/] [g++.bugs/] [900514_03.C] - Blame information for rev 699

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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