[llvm-bugs] [Bug 25425] New: Unused function parameters not reported by -Wunused-parameter when only used recursively.

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Nov 5 16:50:50 PST 2015


https://llvm.org/bugs/show_bug.cgi?id=25425

            Bug ID: 25425
           Summary: Unused function parameters not reported by
                    -Wunused-parameter when only used recursively.
           Product: clang
           Version: 3.7
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: j.fisher at digipen.edu
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

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. As far as I can tell, neither GCC, nor MSVC
notice this issue either.

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

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20151106/0bb81a3f/attachment-0001.html>


More information about the llvm-bugs mailing list