[llvm-bugs] [Bug 52473] New: false-positive -Wreturn-type error

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Nov 10 13:04:43 PST 2021


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

            Bug ID: 52473
           Summary: false-positive -Wreturn-type error
           Product: clang
           Version: trunk
          Hardware: PC
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: mkaufman at microsoft.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

This is a regression somewhere between clang revision 
`llvmorg-14-init-7378-gaee49255` and `llvmorg-14-init-8281-gaa1d32f5 - build
7378 has expected behavior. 

Repro: 
1.  Save code below to file file `a.m`
2.  Compile code: `bin/clang -Wreturn-type -Wno-objc-root-class -c -o a.o a.m`


```
@interface Bar
- (Bar*)baz;
- (Bar*)quux;
- (int)query;
@end
@implementation Bar
- (Bar* ) baz
{
    @try {
        @throw self;
    } @catch (Bar*) {
        return self;
    }
    return (Bar*)0;
}
@end
```

Expected behavior: 
  compilation is free from warnings


Actual behavior:
  $ bin/clang -Wreturn-type -Wno-objc-root-class -c -o a.o a.m
  a.m:14:1: warning: non-void function does not return a value in all control
paths [-Wreturn-type]
}
^
1 warning generated.

-- 
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/20211110/19e396ab/attachment.html>


More information about the llvm-bugs mailing list