From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ryszard Kabatek To: egcs@egcs.cygnus.com Subject: Strange warnings Date: Mon, 31 May 1999 21:36:00 -0000 Message-ID: X-SW-Source: 1999-05n/msg00103.html Message-ID: <19990531213600.OwqieMK3SOPAVzjLltqia7JJR2cP6F8g83sY6vBMPBg@z> In the sample below the class X should have a standard constructor generated by the compiler. But I get the following warnings: # eg++ x.cc x.cc:6: warning: `class X' only defines private constructors and has no friends x.cc: In function `static class X * X::create()': x.cc:5: no matching function for call to `X::X ()' x.cc:3: candidates are: X::X(const X &) The first warning I get too if I define a private standard constructor. But there is a static function, that creates new instances of X, class X does not need friend functions or classes. # cat x.cc class X { X(const X&); public: static X* create() {return new X();} }; int main(int argc, char* argv) { X* p = X::create(); delete p; } Ryszard Kabatek Martin-Luther University Halle-Wittenberg, Department of Physical Chemistry Geusaer Str. 88, 06217 Merseburg, Germany Tel. +49 3461 46 2487 Fax. +49 3461 46 2129