diff options
author | John Hodge <tpg@mutabah.net> | 2018-03-03 22:08:40 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2018-03-03 22:08:40 +0800 |
commit | 4fd34c0410ee16cda693e9f1e7b9a6e5a7a0b0aa (patch) | |
tree | 97d85d0e6d0053c020b0feb56c175c0712a3a6fe /src | |
parent | 8a8472b9111b7d8684af1ed0de598e159100883e (diff) | |
download | mrust-4fd34c0410ee16cda693e9f1e7b9a6e5a7a0b0aa.tar.gz |
Codegen C - Avoid attempting to get type of a non-LValue when looking for ZSTs
Diffstat (limited to 'src')
-rw-r--r-- | src/trans/codegen_c.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/trans/codegen_c.cpp b/src/trans/codegen_c.cpp index 829aa7f7..5c180fe7 100644 --- a/src/trans/codegen_c.cpp +++ b/src/trans/codegen_c.cpp @@ -2774,13 +2774,16 @@ namespace { { // HACK: Don't emit assignment of PhantomData ::HIR::TypeRef tmp; - const auto& ty = mir_res.get_param_type(tmp, ve.vals[j]); - if( ve.vals[j].is_LValue() && m_resolve.is_type_phantom_data(ty) ) - continue ; - - if( this->type_is_bad_zst(ty) ) + if( ve.vals[j].is_LValue() ) { - continue ; + const auto& ty = mir_res.get_param_type(tmp, ve.vals[j]); + if( ve.vals[j].is_LValue() && m_resolve.is_type_phantom_data(ty) ) + continue ; + + if( this->type_is_bad_zst(ty) ) + { + continue ; + } } if(has_emitted) { |