Do implicitly generated copy-assignment operators count?

Moderators: david ward, misra cpp

gs
Posts: 87
Joined: Thu Nov 18, 2004 1:39 am

Do implicitly generated copy-assignment operators count?

Postby gs » Tue Sep 09, 2008 6:31 pm

Rule 12-8-2 states:
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:
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:

Code: Select all

class A
    {
    virtual void b() = 0;
    };

?

misra cpp
Posts: 145
Joined: Mon Jun 02, 2008 1:55 pm
Company: MISRA

Re: Do implicitly generated copy-assignment operators count?

Postby misra cpp » Tue Oct 11, 2016 11:05 am

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


Return to “6.12 Special member functions (C++)”

Who is online

Users browsing this forum: No registered users and 0 guests