Skip to content

Commit

Permalink
cg: add explicit test for const param promotion
Browse files Browse the repository at this point in the history
  • Loading branch information
lcnr committed Nov 12, 2020
1 parent 12f0dba commit c56add0
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/test/ui/const-generics/promotion.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// run-pass
// tests that promoting expressions containing const parameters is allowed.
#![feature(min_const_generics)]

fn promotion_test<const N: usize>() -> &'static usize {
&(3 + N)
}

fn main() {
assert_eq!(promotion_test::<13>(), &16);
}

0 comments on commit c56add0

Please sign in to comment.