[Bug c++/81873] New: spurious -Wreturn-type calling a locally declared noreturn function
msebor at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Aug 17 07:58:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81873
Bug ID: 81873
Summary: spurious -Wreturn-type calling a locally declared
noreturn function
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: msebor at gcc dot gnu.org
Target Milestone: ---
When a noreturn function first locally declared in another function and then
redeclared in another function without attribute noreturn is called the C front
end correctly avoids warning if the call isn't followed by a return statement
in a function expected to return a value.
The test case below shows that the C++ front end doesn't handle this case
correctly and issues a spurious warning.
$ cat t.C && gcc -S -Wall -Wextra -Wpedantic t.C
void f (void)
{
int __attribute__ ((noreturn)) g ();
}
int h (void)
{
int g ();
g ();
}
t.C: In function ‘int h()’:
t.C:11:1: warning: no return statement in function returning non-void
[-Wreturn-type]
}
^
More information about the Gcc-bugs
mailing list