summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2019-11-07 01:22:39 +0800
committerJohn Hodge <tpg@mutabah.net>2019-11-07 01:22:39 +0800
commit30a09a8c7cf08b03b3d11229c5eb20467f296ce5 (patch)
treea36419ecf43bb00692696f199d14fed386f581fe
parent359b714550d2705510beaa194e693ec937de37b8 (diff)
downloadmrust-30a09a8c7cf08b03b3d11229c5eb20467f296ce5.tar.gz
HIR Typecheck - Work around a GCC 9 bug
-rw-r--r--src/hir_typeck/expr_check.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/hir_typeck/expr_check.cpp b/src/hir_typeck/expr_check.cpp
index 7c9367e4..bdd5e4a7 100644
--- a/src/hir_typeck/expr_check.cpp
+++ b/src/hir_typeck/expr_check.cpp
@@ -887,12 +887,16 @@ namespace {
else
{
// 1. Look up the encoded trait
- const auto& trait = (
- node.m_trait_used == ::HIR::ExprNode_CallValue::TraitUsed::Fn ? m_resolve.m_crate.get_lang_item_path(node.span(), "fn")
- : node.m_trait_used == ::HIR::ExprNode_CallValue::TraitUsed::FnMut ? m_resolve.m_crate.get_lang_item_path(node.span(), "fn_mut")
- : node.m_trait_used == ::HIR::ExprNode_CallValue::TraitUsed::FnOnce ? m_resolve.m_crate.get_lang_item_path(node.span(), "fn_once")
- : throw ""
- );
+ const ::HIR::SimplePath* trait_p;
+ switch(node.m_trait_used)
+ {
+ case ::HIR::ExprNode_CallValue::TraitUsed::Fn: trait_p = &m_resolve.m_crate.get_lang_item_path(node.span(), "fn"); break;
+ case ::HIR::ExprNode_CallValue::TraitUsed::FnMut: trait_p = &m_resolve.m_crate.get_lang_item_path(node.span(), "fn_mut"); break;
+ case ::HIR::ExprNode_CallValue::TraitUsed::FnOnce: trait_p = &m_resolve.m_crate.get_lang_item_path(node.span(), "fn_once"); break;
+ default:
+ throw "";
+ }
+ const auto& trait = *trait_p;
::std::vector< ::HIR::TypeRef> tup_ents;
for(const auto& arg : node.m_args) {