diff --git a/src/librustc_trans/trans/base.rs b/src/librustc_trans/trans/base.rs index 390c0b035fdd5..8eb655ccb7a36 100644 --- a/src/librustc_trans/trans/base.rs +++ b/src/librustc_trans/trans/base.rs @@ -1676,7 +1676,7 @@ pub fn trans_named_tuple_constructor<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>, if !type_is_zero_size(ccx, result_ty) { alloc_ty(bcx, result_ty, "constructor_result") } else { - C_undef(type_of::type_of(ccx, result_ty)) + C_undef(type_of::type_of(ccx, result_ty).ptr_to()) } } }; diff --git a/src/test/run-pass/issue26127.rs b/src/test/run-pass/issue26127.rs new file mode 100644 index 0000000000000..75cbcc83d6102 --- /dev/null +++ b/src/test/run-pass/issue26127.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. + +trait Tr { type T; } +impl Tr for u8 { type T=(); } +struct S(I::T); + +fn foo(i: I::T) { + S::(i); +} + +fn main() { + foo::(()); +}