This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
How to prevent compiler-generated member functions?
- From: Nicolas F Rouquette <nicolas dot rouquette at jpl dot nasa dot gov>
- To: gcc-help at gcc dot gnu dot org
- Date: Mon, 21 Apr 2003 11:06:18 -0700
- Subject: How to prevent compiler-generated member functions?
- Organization: Jet Propulsion Laboratory
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.