Skip to content

Commit d76cdb0

Browse files
committed
const param macro test
1 parent 25f6938 commit d76cdb0

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// run-pass
2+
// revisions: full min
3+
4+
#![cfg_attr(full, feature(const_generics))]
5+
#![cfg_attr(full, allow(incomplete_features))]
6+
#![cfg_attr(min, feature(min_const_generics))]
7+
8+
macro_rules! bar {
9+
($($t:tt)*) => { impl<const N: usize> $($t)* };
10+
}
11+
12+
macro_rules! baz {
13+
($t:tt) => { fn test<const M: usize>(&self) -> usize { $t } };
14+
}
15+
16+
struct Foo<const N: usize>;
17+
18+
bar!(Foo<N> { baz!{ M } });
19+
20+
fn main() {
21+
assert_eq!(Foo::<7>.test::<3>(), 3);
22+
}

0 commit comments

Comments
 (0)