[Bug c++/86642] New: Spurious return type warning with enable_if<foo, void>
steinar+gcc at gunderson dot no
gcc-bugzilla@gcc.gnu.org
Mon Jul 23 09:34:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86642
Bug ID: 86642
Summary: Spurious return type warning with enable_if<foo, void>
Product: gcc
Version: 8.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: steinar+gcc at gunderson dot no
Target Milestone: ---
Hi,
The following program gives a warning with -Wall:
#include <type_traits>
std::enable_if<true, void>
func() {}
klump:~> g++-8 -O2 -std=gnu++14 -Wall -c test.cpp
test.cpp: In function ‘std::enable_if<true, void> func()’:
test.cpp:4:9: warning: no return statement in function returning non-void
[-Wreturn-type]
func() {}
^
The function technically returns non-void, but in reality, it returns void
(nothing will ever look at its return type). Thus, the warning should not
really be there.
Same issue with 4.9, so no regression. Clang has the same issue.
More information about the Gcc-bugs
mailing list