summary refs log tree commit diff
path: root/src/test/ui/consts/const-eval/conditional_array_execution.rs
blob: 2058d2e218473b925ca224333fcc1effa6beee25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// build-fail

#![warn(const_err)]

const X: u32 = 5;
const Y: u32 = 6;
const FOO: u32 = [X - Y, Y - X][(X < Y) as usize];
//~^ WARN any use of this value will cause an error

fn main() {
    println!("{}", FOO);
    //~^ ERROR
    //~| WARN erroneous constant used [const_err]
}