[Bug c++/68230] New: Unused function parameters not reported by -Wunused-parameter when only used recursively.
j.fisher at digipen dot edu
gcc-bugzilla@gcc.gnu.org
Fri Nov 6 01:11:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68230
Bug ID: 68230
Summary: Unused function parameters not reported by
-Wunused-parameter when only used recursively.
Product: gcc
Version: 5.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: j.fisher at digipen dot edu
Target Milestone: ---
The code below does not produce a warning when -Wunused-parameter is turned on.
It would be fantastic if it did, as fundamentally, the variable notUsed is
still not actually being used.
#include <iostream>
using namespace std;
int Recursive(int num, const char *notUsed);
int main() {
const char *notUsedLocal = "Not used";
cout << "Test: " << Recursive(1, notUsedLocal) << endl;
return 0;
}
int Recursive(int num, const char *notUsed) {
if (num > 5)
return num;
else
return Recursive(++num, notUsed);
}
More information about the Gcc-bugs
mailing list