about summary refs log tree commit diff
path: root/tests/ui/structs/default-field-values/invalid-const.rs
blob: ddb73f688659caf1a4d69bf153f54c53756db07b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#![feature(default_field_values, generic_const_exprs)]
#![allow(incomplete_features)]

pub struct Bat {
    pub bax: u8 = panic!("asdf"),
    //~^ ERROR evaluation panicked: asdf
}

pub struct Baz<const C: u8> {
    pub bax: u8 = 130 + C, // ok
    pub bat: u8 = 130 + 130,
    //~^ ERROR attempt to compute `130_u8 + 130_u8`, which would overflow
    pub bay: u8 = 1, // ok
}

fn main() {}