[Bug c++/11964] New: Incorrect warning: statement has no effect for new ARRAY[}
gerald at pfeifer dot com
gcc-bugzilla@gcc.gnu.org
Mon Aug 18 10:42:00 GMT 2003
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;
}
More information about the Gcc-bugs
mailing list