Skip to content

[C++] Move assignment operator and constant qualifier #274

@mstanichenko

Description

@mstanichenko

Hello,

I've been playing with simple-binary-encoding and CME templates and came across an issue which I don't know how to resolve. I am not able to compile generated stubs because they have a constant parameter for default move assignment operator. Below is a model example which illustrates a problem:

class A {
public:
  A(){};
  ~A(){};

  A(A&& other) = default;
  A& operator=(const A&& other) = default;
};

int main()
{
  A a;

  return 0;
}
$ g++ -std=c++11 a.cc
a.cc:7:6: error: defaulted declaration ‘A& A::operator=(const A&&)’
   A& operator=(const A&& other) = default;
      ^
a.cc:7:6: error: does not match expected signature ‘A& A::operator=(A&&)’

For example, this issue occurs if one generates stubs based on CME template file and tries to include generated MessageHeader.hpp header

Would you be so kind as to elaborate on it? Do we really need a const rvalue here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions