about summary refs log tree commit diff
path: root/tests/ui/const-generics/defaults/const-param-in-ty-defaults.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/const-generics/defaults/const-param-in-ty-defaults.rs')
-rw-r--r--tests/ui/const-generics/defaults/const-param-in-ty-defaults.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/ui/const-generics/defaults/const-param-in-ty-defaults.rs b/tests/ui/const-generics/defaults/const-param-in-ty-defaults.rs
new file mode 100644
index 00000000000..5f0cafe2ef1
--- /dev/null
+++ b/tests/ui/const-generics/defaults/const-param-in-ty-defaults.rs
@@ -0,0 +1,12 @@
+// run-pass
+struct Foo<const N: usize, T = [u8; N]>(T);
+
+impl<const N: usize> Foo<N> {
+    fn new() -> Self {
+        Foo([0; N])
+    }
+}
+
+fn main() {
+    assert_eq!(Foo::new().0, [0; 10]);
+}