[prev in list] [next in list] [prev in thread] [next in thread]
List: gcc-bugs
Subject: [Bug c++/84621] New: bogus -Wresturn-type on a template instantiated on a function
From: "msebor at gcc dot gnu.org" <gcc-bugzilla () gcc ! gnu ! org>
Date: 2018-02-28 21:53:32
Message-ID: bug-84621-4 () http ! gcc ! gnu ! org/bugzilla/
[Download RAW message or body]
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84621
Bug ID: 84621
Summary: bogus -Wresturn-type on a template instantiated on a
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 non-void function template that doesn't return value and that is
parameterized on a function pointer is instantiated on the address of a
noreturn function calls the function, G++ issues a bogus -Wreturn-type warning
even though it successfully eliminates statements after the call to the
noreturn function (as it should).
Interestingly, other compilers suffer the same or similar problem. Clang and
ICC issue the same bogus warning while also eliminating the second call, and
MSVC doesn't warn or eliminate the call.
$ cat b.C && gcc -O -S -Wall -Wextra -fdump-tree-optimized=/dev/stdout b.C
template <void f ()>
int ff ()
{
f ();
f (); // eliminated
} // bogus -Wreturn-type
void __attribute__ ((noreturn)) f ();
template int ff<f>();
b.C: In function ‘int ff()':
b.C:6:1: warning: no return statement in function returning non-void
[-Wreturn-type]
} // bogus -Wreturn-type
^
;; Function ff<f> (_Z2ffIXadL_Z1fvEEEiv, funcdef_no=1, decl_uid=2366,
cgraph_uid=0, symbol_order=0)
ff<f> ()
{
<bb 2> [local count: 1073741825]:
f ();
}=
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic