Skip to content

Commit f8c5a0a

Browse files
committed
Fix AttrInputMacro operator= overloading.
gcc/rust/ChangeLog: * ast/rust-ast.cc (AttrInputMacro::operator=): Add return type. * ast/rust-expr.h: Likewise. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
1 parent 6959a07 commit f8c5a0a

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

gcc/rust/ast/rust-ast.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4339,11 +4339,12 @@ AttrInputMacro::AttrInputMacro (const AttrInputMacro &oth)
43394339
: macro (oth.macro->clone_macro_invocation_impl ())
43404340
{}
43414341

4342-
void
4342+
AttrInputMacro &
43434343
AttrInputMacro::operator= (const AttrInputMacro &oth)
43444344
{
43454345
macro = std::unique_ptr<MacroInvocation> (
43464346
oth.macro->clone_macro_invocation_impl ());
4347+
return *this;
43474348
}
43484349

43494350
/* Visitor implementations - these are short but inlining can't happen anyway

gcc/rust/ast/rust-expr.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,13 @@ class AttrInputMacro : public AttrInput
183183

184184
AttrInputMacro (AttrInputMacro &&oth) : macro (std::move (oth.macro)) {}
185185

186-
void operator= (const AttrInputMacro &oth);
186+
AttrInputMacro &operator= (const AttrInputMacro &oth);
187187

188-
void operator= (AttrInputMacro &&oth) { macro = std::move (oth.macro); }
188+
AttrInputMacro &operator= (AttrInputMacro &&oth)
189+
{
190+
macro = std::move (oth.macro);
191+
return *this;
192+
}
189193

190194
std::string as_string () const override;
191195

0 commit comments

Comments
 (0)