summary refs log tree commit diff
path: root/src/test/ui/const-generics/raw-ptr-const-param-deref.rs
blob: 745dde3c2876661236df9fb48392f1be6d58071a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// run-pass
#![feature(const_generics, const_compare_raw_pointers)]
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash

const A: u32 = 3;

struct Const<const P: *const u32>;

impl<const P: *const u32> Const<P> {
    fn get() -> u32 {
        unsafe {
            *P
        }
    }
}

fn main() {
    assert_eq!(Const::<{&A as *const _}>::get(), 3)
}