-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Open
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillac++clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzer
Description
| Bugzilla Link | 11351 |
| Version | 2.9 |
| OS | Linux |
| Reporter | LLVM Bugzilla Contributor |
| CC | @DougGregor,@gribozavr |
Extended Description
It would be great if clang showed warnings about common incorrect usage of exceptions and appropriate fix-it hint.
That is:
- "throw new"
- catch by value
- 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;
}Metadata
Metadata
Assignees
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillac++clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzer