This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/81873] New: spurious -Wreturn-type calling a locally declared noreturn function
- From: "msebor at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 16 Aug 2017 23:34:08 +0000
- Subject: [Bug c++/81873] New: spurious -Wreturn-type calling a locally declared noreturn function
- Auto-submitted: auto-generated
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]
}
^