aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>2024-11-20 01:44:28 +0100
committerArthur Cohen <arthur.cohen@embecosm.com>2025-03-21 12:32:58 +0100
commit1d628b8920ebf3d2c4244b02ab91297b5a0151dd (patch)
treefbea5f08f1073eae8b57735f4e63faf9072099ba /gcc
parentb3246d3ff22035cff465e75ebe42ff2be4ce46d2 (diff)
downloadgcc-1d628b8920ebf3d2c4244b02ab91297b5a0151dd.zip
gcc-1d628b8920ebf3d2c4244b02ab91297b5a0151dd.tar.gz
gcc-1d628b8920ebf3d2c4244b02ab91297b5a0151dd.tar.bz2
gccrs: 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')
-rw-r--r--gcc/rust/hir/rust-ast-lower-expr.cc5
-rw-r--r--gcc/rust/hir/rust-ast-lower-type.cc8
-rw-r--r--gcc/rust/typecheck/rust-hir-type-check-type.cc4
3 files changed, 11 insertions, 6 deletions
diff --git a/gcc/rust/hir/rust-ast-lower-expr.cc b/gcc/rust/hir/rust-ast-lower-expr.cc
index 2954a31..b45b5f9 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 5836c1a..58c93b9 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 (),
diff --git a/gcc/rust/typecheck/rust-hir-type-check-type.cc b/gcc/rust/typecheck/rust-hir-type-check-type.cc
index 089a5af..6e859e5 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-type.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check-type.cc
@@ -829,7 +829,9 @@ TypeResolveGenericParam::visit (HIR::TypeParam &param)
HIR::TraitBound &b = static_cast<HIR::TraitBound &> (*bound);
TyTy::TypeBoundPredicate predicate = get_predicate_from_bound (
- b.get_path (), tl::optional (std::ref (*implicit_self_bound)),
+ b.get_path (),
+ tl::optional<std::reference_wrapper<HIR::Type>> (
+ std::ref (*implicit_self_bound)),
b.get_polarity ());
if (!predicate.is_error ())
{