summaryrefslogtreecommitdiffstats
path: root/tests/ui/typeof/type_mismatch.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/typeof/type_mismatch.rs')
-rw-r--r--tests/ui/typeof/type_mismatch.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/ui/typeof/type_mismatch.rs b/tests/ui/typeof/type_mismatch.rs
new file mode 100644
index 000000000..3f8339fa5
--- /dev/null
+++ b/tests/ui/typeof/type_mismatch.rs
@@ -0,0 +1,9 @@
+// Test that using typeof results in the correct type mismatch errors instead of always assuming
+// `usize`, in addition to the pre-existing "typeof is reserved and unimplemented" error
+fn main() {
+ const a: u8 = 1;
+ let b: typeof(a) = 1i8;
+ //~^ ERROR `typeof` is a reserved keyword but unimplemented
+ //~| ERROR mismatched types
+ //~| expected `u8`, found `i8`
+}