2018-08-30 14:18:55 +02:00
|
|
|
//@ run-pass
|
2017-02-28 23:46:47 +00:00
|
|
|
use std::ops::Index;
|
|
|
|
|
fn bar() {}
|
|
|
|
|
static UNIT: () = ();
|
|
|
|
|
struct S;
|
|
|
|
|
impl Index<fn()> for S {
|
|
|
|
|
type Output = ();
|
|
|
|
|
fn index(&self, _: fn()) -> &() { &UNIT }
|
|
|
|
|
}
|
|
|
|
|
fn main() {
|
|
|
|
|
S.index(bar);
|
|
|
|
|
S[bar];
|
|
|
|
|
}
|