This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/68230] New: Unused function parameters not reported by -Wunused-parameter when only used recursively.


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);
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]