https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90633

            Bug ID: 90633
           Summary: inaccurate line number control reaches end of non-void
                    function [-Wreturn-type]
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jg at jguk dot org
  Target Milestone: ---

inaccurate line number control reaches end of non-void function [-Wreturn-type]
if -O2 is used. Not sure why, but it should be line 15 always I thought.


#1 with x86-64 gcc (trunk)
<source>: In function 'int f()':
<source>:7:15: warning: control reaches end of non-void function
[-Wreturn-type]
    7 |     strvecs_t h;
      |               ^
Compiler returned: 0


#include <string>
#include <vector>

typedef std::vector<std::string> strvecs_t;
int f()
{
    strvecs_t h;

    h.push_back("f");

    if(!h.empty())
    {
        return -1;
    }
}

Reply via email to