Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Do implicitly generated copy-assignment operators count?
Rule 12-8-2 states:
Quote:The copy assignment operator shall be declared protected or private in an abstract class.
Does this prohibition also include the implicitly generated copy assignment operator? When implicitly generated, ISO C++, 12.8, p. 10, states:
Quote:An implicitly-declared copy assignment operator is an inline public member of its class.
So, does the following code comply with rule 12-8-2:
class A
    virtual void b() = 0;
Yes, as by default they are public. The code does not comply with 12-8-2 as the copy assignment operator is not private or protected
Posted by and on behalf of
the MISRA C++ Working Group

Forum Jump:

Users browsing this thread: 1 Guest(s)