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

            Bug ID: 52274
           Summary: -Wunused-but-set-parameter diagnostic warns about
                    parameter += 1 but not parameter++
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangb...@nondot.org
          Reporter: cpeter...@mozilla.com
                CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org,
                    neeil...@live.com, richard-l...@metafoo.co.uk

When compiled with `clang++ -Wunused-but-set-parameter test.cpp`, the following
test program reports the following warnings:

test.cpp:8:14: warning: parameter 'a' set but not used
[-Wunused-but-set-parameter]
void foo(int a, int b, int c) {
             ^
test.cpp:8:21: warning: parameter 'b' set but not used
[-Wunused-but-set-parameter]
void foo(int a, int b, int c) {


void foo(int a, int b, int c) {
  a = 1;  // PASS: expect warning, got warning
  b += 1; // PASS: expect warning, got warning
  c++;    // FAIL? expect warning because c++ result unused, got no warning
}

If `b += 1` is considered "setting but not using" b, then shouldn't `c++` also
be considered "setting but not using" parameter c?

I am using Homebrew clang version 13.0.0 on macOS 11.6.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to