rspec/rules/S1045/noncompliant.adoc

21 lines
368 B
Plaintext
Raw Normal View History

=== Noncompliant code example
2020-06-30 12:47:33 +02:00
2022-02-04 17:28:24 +01:00
[source,text]
2020-06-30 12:47:33 +02:00
----
class BaseException { };
class DerivedException: public BaseException { };
try
{
// ...
}
catch ( BaseException &b ) // Will catch DerivedException as well
{
// ...
}
catch ( DerivedException &d ) // Noncompliant, the previous handled effectively hides this one
{
// Any code here will be unreachable,
}
----