summary refs log tree commit diff
path: root/src/test/ui/consts/const-eval/issue-50814.rs
blob: 5c3635e4650cd4ee059bf16fb854fc84c73006aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// build-fail

trait Unsigned {
    const MAX: u8;
}

struct U8(u8);
impl Unsigned for U8 {
    const MAX: u8 = 0xff;
}

struct Sum<A,B>(A,B);

impl<A: Unsigned, B: Unsigned> Unsigned for Sum<A,B> {
    const MAX: u8 = A::MAX + B::MAX;
    //~^ ERROR any use of this value will cause an error [const_err]
}

fn foo<T>(_: T) -> &'static u8 {
    &Sum::<U8,U8>::MAX
    //~^ ERROR E0080
}

fn main() {
    foo(0);
}