Add a test for #44255

This commit is contained in:
varkor 2019-02-25 23:55:16 +00:00
parent 3f16518c05
commit ec56d6e5b9

View file

@ -0,0 +1,29 @@
// run-pass
use std::marker::PhantomData;
fn main() {
let _arr = [1; <Multiply<Five, Five>>::VAL];
}
trait TypeVal<T> {
const VAL: T;
}
struct Five;
impl TypeVal<usize> for Five {
const VAL: usize = 5;
}
struct Multiply<N, M> {
_n: PhantomData<N>,
_m: PhantomData<M>,
}
impl<N, M> TypeVal<usize> for Multiply<N, M>
where N: TypeVal<usize>,
M: TypeVal<usize>,
{
const VAL: usize = N::VAL * M::VAL;
}