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: [email protected]
ReportedBy: [email protected]
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