From: Ryszard Kabatek <rysio@rumcajs.chemie.uni-halle.de>
To: egcs@egcs.cygnus.com
Subject: Strange warnings
Date: Wed, 05 May 1999 01:12:00 -0000 [thread overview]
Message-ID: <Pine.LNX.3.96.990505100034.8687A-100000@rumcajs.chemie.uni-halle.de> (raw)
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
WARNING: multiple messages have this Message-ID
From: Ryszard Kabatek <rysio@rumcajs.chemie.uni-halle.de>
To: egcs@egcs.cygnus.com
Subject: Strange warnings
Date: Mon, 31 May 1999 21:36:00 -0000 [thread overview]
Message-ID: <Pine.LNX.3.96.990505100034.8687A-100000@rumcajs.chemie.uni-halle.de> (raw)
Message-ID: <19990531213600.OwqieMK3SOPAVzjLltqia7JJR2cP6F8g83sY6vBMPBg@z> (raw)
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
next reply other threads:[~1999-05-05 1:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-05-05 1:12 Ryszard Kabatek [this message]
1999-05-05 5:45 ` Gabriel Dos_Reis
1999-05-31 21:36 ` Gabriel Dos_Reis
1999-05-31 21:36 ` Ryszard Kabatek
-- strict thread matches above, loose matches on Subject: below --
2001-09-19 13:40 Strange Warnings Frank Klemm
2001-09-20 18:04 ` Zack Weinberg
1998-08-17 17:41 Sebastian Ritterbusch
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.3.96.990505100034.8687A-100000@rumcajs.chemie.uni-halle.de \
--to=rysio@rumcajs.chemie.uni-halle.de \
--cc=egcs@egcs.cygnus.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).