| 1 |
// { dg-do run } |
| 2 |
// { dg-options "" } |
| 3 |
// g++ 1.37.1 bug 900331_03 |
| 4 |
|
| 5 |
// Special Options: -ansi |
| 6 |
|
| 7 |
// The following code causes g++ to abort. |
| 8 |
|
| 9 |
// Curiously, the abort does not occur if the -pedantic option is used. |
| 10 |
|
| 11 |
// Cfront 2.0 passes this test. |
| 12 |
|
| 13 |
// Keywords: abort, conditional operator?:, lvalues, composite types |
| 14 |
|
| 15 |
struct struct0 { |
| 16 |
int data_member; |
| 17 |
|
| 18 |
virtual void function_member () {} // contributes to the abort |
| 19 |
}; |
| 20 |
|
| 21 |
struct0 object0; |
| 22 |
struct0 object1; |
| 23 |
struct0 object2; |
| 24 |
|
| 25 |
int i; |
| 26 |
|
| 27 |
void function0 () |
| 28 |
{ |
| 29 |
object2 = (i ? object0 : object1); // OK |
| 30 |
(i ? object0 : object1) = object2; // causes abort |
| 31 |
} |
| 32 |
|
| 33 |
int main () { return 0; } |