[Bug c++/30601] New: [4.3 regression] -Wreturn-type warns about more than what the documentation says
bangerth at dealii dot org
gcc-bugzilla@gcc.gnu.org
Fri Jan 26 18:30:00 GMT 2007
This little code
---------------
const double foo() { return 1.; }
---------------
used to be fine in C++ even in the presence of -Wreturn-type but now
yields a warning with recent mainline:
deal.II/tests> /tmp/bangerth/bin/bin/c++ -Wreturn-type -c x.cc
x.cc:1: warning: type qualifiers ignored on function return type
The point is that in C++, this sort of code is pretty common
because the return type may be a template-type or derived through
template metaprogramming typedef tricks, unlike in C where it may
indeed be an oversight. The documentation appears to recognize this
because it says that -Wreturn-type only warns about the const
qualifier for C, not for C++. Yet, the current code does warn. I
suspect that this was introduced in the recent reorganizations of
much of the warnings.
Best
Wolfgang
--
Summary: [4.3 regression] -Wreturn-type warns about more than
what the documentation says
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: bangerth at dealii dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30601
More information about the Gcc-bugs
mailing list