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

            Bug ID: 51228
           Summary: warn_unused_result and cast to void
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C
          Assignee: unassignedclangb...@nondot.org
          Reporter: ndesaulni...@google.com
                CC: aa...@aaronballman.com, blitzrak...@gmail.com,
                    dgre...@apple.com, erik.pilking...@gmail.com,
                    isanb...@gmail.com, llvm-bugs@lists.llvm.org,
                    richard-l...@metafoo.co.uk

$ cat foo.c
__attribute__((warn_unused_result))
int foo(void);

void bar(void) {
    (void)foo(); // cast result to void
}

$ gcc foo.c
warning: ignoring return value of 'foo' declared with attribute
'warn_unused_result' [-Wunused-result]
    9 |     (void)foo(); // cast result to void
      |           ^~~~~

$ clang foo.c
$

-- 
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