https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69521
Bug ID: 69521
Summary: -Wdeprecated-declarations errors in unused inline
methods
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: loic.yhuel at gmail dot com
Target Milestone: ---
In Qt's qalgorithms.h, there is a deprecated inline method using a deprecated
class, which can be simplified to :
class __attribute__((deprecated)) qLess { };
__attribute__((deprecated)) inline void qLowerBound()
{
qLess();
}
int main()
{
return 0;
}
=> "warning: ‘qLess’ is deprecated [-Wdeprecated-declarations]" with g++ 4.9.3
/ 5.2.1 / 5.3.0 / 5.3.1
With g++ 4.8.4, there was no warning.
It's even worse using a deprecated method :
__attribute__((deprecated)) inline void qLess() {}
__attribute__((deprecated)) inline void qLowerBound()
{
qLess();
}
int main()
{
return 0;
}
=> "warning: ‘void qLess()’ is deprecated [-Wdeprecated-declarations]"
The warning is printed :
- 3 times in C++ mode with g++ 5.2.1 / 5.3 / 5.3.1
- 2 times in C++ mode with g++ 4.8.4 / 4.9.3
- 1 time in C mode with gcc 4.8.4 / 4.9.3 / 5.2.1 / 5.3 / 5.3.1
Perhaps there are two issues here, with the same warning being reported several
times in C++ mode, but the first problem is : should the compiler report
deprecated-declarations warning when the usage is in an unused (especially
inline) function ?
If it's easier to do, perhaps using a deprecated function in a deprecated
function shouldn't produce a warning (deprecated code would be able to use
other deprecated code).