This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/11112] New: wrong warning when classes have private destructors and their first member functions are not static.
- From: "grivet at labri dot fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Jun 2003 17:07:41 -0000
- Subject: [Bug c++/11112] New: wrong warning when classes have private destructors and their first member functions are not static.
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11112
Summary: wrong warning when classes have private destructors and
their first member functions are not static.
Product: gcc
Version: 3.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: grivet@labri.fr
CC: gcc-bugs@gcc.gnu.org
For instance:
class A {
~A() {}
public:
void foo() {
}
static A *instance();
};
A *A::instance() {
return new A;
}
int main() {
return 0;
}
produces:
g++ -Wall -o test test.cpp
test.cpp:1: warning: `class A' only defines a private destructor and has no
friends
Whereas:
class A {
~A() {}
public:
static A *instance(); // only the two member functions are inverted
void foo() {
}
};
A *A::instance() {
return new A;
}
int main() {
return 0;
}
produces no warning.