http://llvm.org/bugs/show_bug.cgi?id=7802
Summary: False positive for -Wunreachable-code
Product: clang
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected], [email protected]
The following typescript shows that clang incorrectly seems to mark as
unreachable a throw of a temporary.
Please note that if I remove the destructor of struct s, no warning is
generated.
$ cat w.cc
struct s {
explicit s() { }
~s() { }
};
int f_bad(int x) {
if (x)
throw s();
return 0;
}
int f_good(int x) {
if (x) {
s e;
throw e;
}
return 0;
}
$ llvm/Debug+Asserts/bin/clang++ -Wunreachable-code -c w.cc
w.cc:8:5: warning: will never be executed [-Wunreachable-code]
throw s();
^~~~~~~~~
1 warning generated.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs