| 1 |
// { dg-options "-w -O0 -fdump-tree-gimple" } |
| 2 |
struct Foo { |
| 3 |
First: i32, |
| 4 |
Second: f32 |
| 5 |
} |
| 6 |
|
| 7 |
struct Bar { |
| 8 |
First: i32, |
| 9 |
Second: f32 |
| 10 |
} |
| 11 |
|
| 12 |
struct Baz { |
| 13 |
First: i32, |
| 14 |
Second: f32 |
| 15 |
} |
| 16 |
const A:Foo = Foo { First: 1, Second: 1.0 }; |
| 17 |
const B:Bar = Bar { First: 2, Second: 2.0 }; |
| 18 |
const C:Baz = Baz { First: 3, Second: 2.0 }; |
| 19 |
|
| 20 |
const fn test() -> f32 { |
| 21 |
if (A.First == 2) { |
| 22 |
return A.Second; |
| 23 |
} |
| 24 |
else if (B.First == 2) { |
| 25 |
return B.Second; |
| 26 |
} |
| 27 |
else if (C.First == 2) { |
| 28 |
return C.Second; |
| 29 |
} |
| 30 |
|
| 31 |
return 0.0; |
| 32 |
} |
| 33 |
|
| 34 |
const D:f32 = test(); |
| 35 |
|
| 36 |
fn main() { |
| 37 |
// { dg-final { scan-tree-dump-times {d = 2.0} 1 gimple } } |
| 38 |
let d = D; |
| 39 |
} |
| 40 |
|