This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

How to prevent compiler-generated member functions?


Suppose we have this code:

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

void bar()
{
   foo f1; // (1)
   foo f2; // (1)
   f1 = f2; // (2)
   foo f3 = foo(); // (3)
}

Is there a compiler switch where (1), (2), (3) would all produce errors?

(1) => no default constructor defined
(2) => no copy assignment operator defined
(3) => no copy constructor defined

Without any flags, this code compiles cleanly.

-- Nicolas.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]