summaryrefslogtreecommitdiff
path: root/tests/ui/numbers-arithmetic/overflow-attribute-works-2.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/numbers-arithmetic/overflow-attribute-works-2.rs')
-rw-r--r--tests/ui/numbers-arithmetic/overflow-attribute-works-2.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/ui/numbers-arithmetic/overflow-attribute-works-2.rs b/tests/ui/numbers-arithmetic/overflow-attribute-works-2.rs
new file mode 100644
index 00000000000..0367d980a64
--- /dev/null
+++ b/tests/ui/numbers-arithmetic/overflow-attribute-works-2.rs
@@ -0,0 +1,19 @@
+// run-pass
+// compile-flags: -C overflow_checks=false
+
+#![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
+}