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

            Bug ID: 59916
           Summary: [4.9 Regression] constructors and destructors can
                    cause "control reaches end of non-void function"
                    warnings with -Os
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: Bernhard.Rosenkranzer at linaro dot org

Created attachment 31929
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31929&action=edit
test case

The following C++ code:

class A
{
};

class B : virtual public A
{
public:
        B();
        virtual ~B();
};

B::B()
{
}

B::~B()
{
}


causes an incorrect warning with current 4.9 git with -Os:

[bero@localhost gcc-test]$ arm-linux-androideabi-g++ -Werror=return-type -Os -o
test.o test.cpp
test.cpp: In constructor 'B::B()':
test.cpp:14:1: error: control reaches end of non-void function
[-Werror=return-type]
 }
 ^
test.cpp: In constructor 'B::B()':
test.cpp:14:1: error: control reaches end of non-void function
[-Werror=return-type]
 }
 ^
test.cpp: In destructor 'B::~B()':
test.cpp:18:1: error: control reaches end of non-void function
[-Werror=return-type]
 }
 ^
test.cpp: In destructor 'virtual B::~B()':
test.cpp:18:1: error: control reaches end of non-void function
[-Werror=return-type]
 }
 ^
cc1plus: some warnings being treated as errors

Reply via email to