[Bug c++/56389] New: Return types differs in block scope function declarations and function implementation

forever14 at bk dot ru gcc-bugzilla@gcc.gnu.org
Tue Feb 19 08:58:00 GMT 2013


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

             Bug #: 56389
           Summary: Return types differs in block scope function
                    declarations and function implementation
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: forever14@bk.ru


Code:

int main()
{
   int f();
   f();
}

void f() { }

http://liveworkspace.org/code/1zsrDJ$3

>From C++ standard:

par 3.3.2/10 Function declarations at block scope and variable declarations
with the extern specifier at block scope refer to declarations that are members
of an enclosing namespace, but they do not introduce new names into that scope.

So, block scope function declaration is allowed, but why there is no diagnostic
on return types? In C such code cause error

http://liveworkspace.org/code/1zsrDJ$4



More information about the Gcc-bugs mailing list