restructure unary_op to also dispatch on type first; fix promotion with unary '-' overflowing

This commit is contained in:
Ralf Jung 2018-08-26 15:13:01 +02:00
parent 066d2eea25
commit e6a5a9418a
2 changed files with 62 additions and 42 deletions

View file

@ -8,10 +8,18 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// compile-flags: -O
fn foo(_: &'static [&'static str]) {}
fn bar(_: &'static [&'static str; 3]) {}
fn baz_i32(_: &'static i32) {}
fn baz_u32(_: &'static u32) {}
fn main() {
foo(&["a", "b", "c"]);
bar(&["d", "e", "f"]);
// make sure that these do not cause trouble despite overflowing
baz_u32(&(0-1));
baz_i32(&-std::i32::MIN);
}