about summary refs log tree commit diff
path: root/src/test/ui/const-generics/generic_const_exprs/different-fn.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/const-generics/generic_const_exprs/different-fn.rs')
-rw-r--r--src/test/ui/const-generics/generic_const_exprs/different-fn.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/ui/const-generics/generic_const_exprs/different-fn.rs b/src/test/ui/const-generics/generic_const_exprs/different-fn.rs
new file mode 100644
index 00000000000..0dcafc6a789
--- /dev/null
+++ b/src/test/ui/const-generics/generic_const_exprs/different-fn.rs
@@ -0,0 +1,17 @@
+#![feature(const_generics, generic_const_exprs)]
+#![allow(incomplete_features)]
+
+use std::mem::size_of;
+use std::marker::PhantomData;
+
+struct Foo<T>(PhantomData<T>);
+
+fn test<T>() -> [u8; size_of::<T>()] {
+    [0; size_of::<Foo<T>>()]
+    //~^ ERROR unconstrained generic constant
+    //~| ERROR mismatched types
+}
+
+fn main() {
+    test::<u32>();
+}