about summary refs log tree commit diff
path: root/tests/ui/numbers-arithmetic/overflow-attribute-works-1.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/numbers-arithmetic/overflow-attribute-works-1.rs')
-rw-r--r--tests/ui/numbers-arithmetic/overflow-attribute-works-1.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/ui/numbers-arithmetic/overflow-attribute-works-1.rs b/tests/ui/numbers-arithmetic/overflow-attribute-works-1.rs
new file mode 100644
index 00000000000..318be2a6401
--- /dev/null
+++ b/tests/ui/numbers-arithmetic/overflow-attribute-works-1.rs
@@ -0,0 +1,19 @@
+// run-pass
+// compile-flags: -C overflow_checks=true
+
+#![feature(cfg_overflow_checks)]
+
+fn main() {
+    assert!(cfg!(overflow_checks));
+    assert!(compiles_differently());
+}
+
+#[cfg(overflow_checks)]
+fn compiles_differently()->bool {
+    true
+}
+
+#[cfg(not(overflow_checks))]
+fn compiles_differently()->bool {
+    false
+}