diff options
Diffstat (limited to 'tests/ui/issues/issue-44255.rs')
-rw-r--r-- | tests/ui/issues/issue-44255.rs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/ui/issues/issue-44255.rs b/tests/ui/issues/issue-44255.rs new file mode 100644 index 000000000..224503204 --- /dev/null +++ b/tests/ui/issues/issue-44255.rs @@ -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; +} |