This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/68230] New: Unused function parameters not reported by -Wunused-parameter when only used recursively.
- From: "j.fisher at digipen dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 06 Nov 2015 01:11:35 +0000
- Subject: [Bug c++/68230] New: Unused function parameters not reported by -Wunused-parameter when only used recursively.
- Auto-submitted: auto-generated
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);
}