http://llvm.org/bugs/show_bug.cgi?id=11351
Bug #: 11351
Summary: warning about common incorrect usage of exceptions
Product: clang
Version: 2.9
Platform: PC
OS/Version: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
It would be great if clang showed warnings about common incorrect usage of
exceptions and appropriate fix-it hint.
That is:
1. "throw new"
2. catch by value
3. rethrow that change exception type
#include <stdexcept>
int main()
{
try
{
throw new std::runtime_error("hello, kitty!"); // warning: "throw new",
fix-it: remove "new"
}
catch (std::exception e) // warning: catch by value, fix-it: add "const&"
or "&"
{
throw e; // warning: rethrow change a type, fix-it: remove "e"
}
return 0;
}
--
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