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++/15333] New: Bogus warning: statement has no effect (regression)


I'm seeing hundreds of warnings like this on a project that uses the idiom of 
self-registering objects.

It only happens if the constructor is a template.

This is a regression wrt previous gcc releases.

// Test case begins

class B {
public:
  B();  // Implemented elsewhere
};


class A {
public:
  template <typename T1>
  A(T1) {
    new B;
  }
};


A a(10);

// Test case ends

t:/sec/exp # g++ -c -Wall p.cpp 
p.cpp: In constructor `A::A(T1)':
p.cpp:11: warning: statement has no effect

-- 
           Summary: Bogus warning:  statement has no effect (regression)
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ofv at wanadoo dot es
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15333


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