aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/hir
diff options
context:
space:
mode:
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>2024-11-20 01:44:28 +0100
committerP-E-P <32375388+P-E-P@users.noreply.github.com>2024-11-20 13:36:42 +0000
commitd29ab973aee29d50de1d5ae9b4ffd38028379a0d (patch)
tree9321499c873455690b21b128c9c8b298dfe1cc95 /gcc/rust/hir
parente4b68a6cd5349ad153ac30cc2ddf668498255e2e (diff)
downloadgcc-d29ab973aee29d50de1d5ae9b4ffd38028379a0d.zip
gcc-d29ab973aee29d50de1d5ae9b4ffd38028379a0d.tar.gz
gcc-d29ab973aee29d50de1d5ae9b4ffd38028379a0d.tar.bz2
Add optional template arguments to please GCC4.8
Clang on macos as well as GCC 4.8 complains when those templates are missing. gcc/rust/ChangeLog: * hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Add template to tl::optional. * hir/rust-ast-lower-type.cc (ASTLowerGenericParam::visit): Likewise. * typecheck/rust-hir-type-check-type.cc (TypeResolveGenericParam::visit): Likewise. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diffstat (limited to 'gcc/rust/hir')
-rw-r--r--gcc/rust/hir/rust-ast-lower-expr.cc5
-rw-r--r--gcc/rust/hir/rust-ast-lower-type.cc8
2 files changed, 8 insertions, 5 deletions
diff --git a/gcc/rust/hir/rust-ast-lower-expr.cc b/gcc/rust/hir/rust-ast-lower-expr.cc
index fb24a72..a8c0730 100644
--- a/gcc/rust/hir/rust-ast-lower-expr.cc
+++ b/gcc/rust/hir/rust-ast-lower-expr.cc
@@ -517,8 +517,9 @@ ASTLoweringExpr::visit (AST::StructExprStructFields &struct_expr)
{
HIR::Expr *translated_base = ASTLoweringExpr::translate (
struct_expr.get_struct_base ().get_base_struct ());
- base = tl::optional (Rust::make_unique<StructBase> (
- std::unique_ptr<HIR::Expr> (translated_base)));
+ base = tl::optional<std::unique_ptr<HIR::StructBase>> (
+ Rust::make_unique<StructBase> (
+ std::unique_ptr<HIR::Expr> (translated_base)));
}
auto const &in_fields = struct_expr.get_fields ();
diff --git a/gcc/rust/hir/rust-ast-lower-type.cc b/gcc/rust/hir/rust-ast-lower-type.cc
index c1bfe21..553c9c9 100644
--- a/gcc/rust/hir/rust-ast-lower-type.cc
+++ b/gcc/rust/hir/rust-ast-lower-type.cc
@@ -503,9 +503,11 @@ ASTLowerGenericParam::visit (AST::TypeParam &param)
}
}
- auto type = param.has_type () ? tl::optional (std::unique_ptr<HIR::Type> (
- ASTLoweringType::translate (param.get_type ())))
- : tl::nullopt;
+ tl::optional<std::unique_ptr<HIR::Type>> type = tl::nullopt;
+ if (param.has_type ())
+ type
+ = tl::optional<std::unique_ptr<HIR::Type>> (std::unique_ptr<HIR::Type> (
+ ASTLoweringType::translate (param.get_type ())));
auto crate_num = mappings.get_current_crate ();
Analysis::NodeMapping mapping (crate_num, param.get_node_id (),