[Bug c/29521] New: Confusing warning for return with expression in function returning void

muntyan at tamu dot edu gcc-bugzilla@gcc.gnu.org
Fri Oct 20 06:17:00 GMT 2006


Consider the following code:

void func () 
{
}

void func2 ()
{
    return func ();
}

gcc -pedantic correctly warns about "return func();", but the warning text is
very confusing:
   'return' with a value, in function returning void
It talks about "value" where there is no value involved.
It took me a while to understand what exactly is wrong. Warning says "value",
so I obviously checked signatures first; then I looked for a problem with
includes; then I asked in comp.lang.c.

It would be better if gcc said something like
   'return' with an expression, in function returning void
or
   ISO C forbids ...

The latter would be the best, I guess.


-- 
           Summary: Confusing warning for return with expression in function
                    returning void
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: muntyan at tamu dot edu


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



More information about the Gcc-bugs mailing list