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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected]

$ 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
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to