https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103745
Bug ID: 103745
Summary: Warn on throwing an exception not derived from
std::exception
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: antoshkka at gmail dot com
Target Milestone: ---
Throwing an exception that is derived from std::exception is a common practice.
Cases when that practice should be skipped are very rare. However, many
beginners do not know about that and erroneously do not derive their exceptions
from std::exception. There are also cases when classes have close names and
users throw the wrong type by a typo.
Please add a warning about throwing an exception not derived from
std::exception.
Godbolt playground: https://godbolt.org/z/7Phf3nafW