This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/11964] New: Incorrect warning: statement has no effect for new ARRAY[}


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;
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]