This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/11964] New: Incorrect warning: statement has no effect for new ARRAY[}
- From: "gerald at pfeifer dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 Aug 2003 10:42:45 -0000
- Subject: [Bug c++/11964] New: Incorrect warning: statement has no effect for new ARRAY[}
- 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=11964
Summary: Incorrect warning: statement has no effect for new
ARRAY[}
Product: gcc
Version: 3.4
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: gerald at pfeifer dot com
CC: gcc-bugs at gcc dot gnu dot org
For the following snippet we are getting two warnings of the form
x.cc: In constructor `C::C()':
x.cc:11: warning: statement has no effect
x.cc: In constructor `C::C(TERM*)':
x.cc:16: warning: statement has no effect
when using g++ -W. Both are clearly bogus:
struct TERM {
unsigned data;
TERM() { data = 0; }
};
struct C {
TERM *t;
C() {
t = new TERM[3];
}
C( TERM *t2 ) {
if( t2 ) {
t = new TERM[3];
t[0]=t2[0];
}
}
};
extern TERM *aTerm;
int main() {
C x(aTerm);
C y=x;
}