From 884b58913ae27c3916f90ae05af01fd8030b6670 Mon Sep 17 00:00:00 2001 From: Simonas Kazlauskas Date: Thu, 15 Oct 2015 18:09:10 +0300 Subject: [PATCH] Add a test for #29071 Fixes #29071 --- src/test/run-pass/issue-29071.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/test/run-pass/issue-29071.rs diff --git a/src/test/run-pass/issue-29071.rs b/src/test/run-pass/issue-29071.rs new file mode 100644 index 00000000000..09c17a85ab5 --- /dev/null +++ b/src/test/run-pass/issue-29071.rs @@ -0,0 +1,21 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +fn ret() -> u32 { + static x: u32 = 10; + x & if true { 10u32 } else { 20u32 } & x +} + +fn ret2() -> &'static u32 { + static x: u32 = 10; + if true { 10u32; } else { 20u32; } + &x +} + +fn main() {}