summaryrefslogtreecommitdiffstats
path: root/src/test/ui/consts/const-fn-method.rs
blob: 002646db92a4fcfba9bf43ad34f42472135d09bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// run-pass

struct Foo { value: u32 }

impl Foo {
    const fn new() -> Foo {
        Foo { value: 22 }
    }
}

const FOO: Foo = Foo::new();

pub fn main() {
    assert_eq!(FOO.value, 22);
    let _: [&'static str; Foo::new().value as usize] = ["hey"; 22];
}