Terminate called after throwing an instance of...

Jeffrey Walton noloader@gmail.com
Mon Sep 5 04:13:00 GMT 2011


On Sun, Sep 4, 2011 at 6:50 PM, Jeffrey Walton <noloader@gmail.com> wrote:
> Hi All,
>
> I'm seeing the following on a negative test case:
>
>    terminate called after throwing an instance of
>    'esapi::NoSuchAlgorithmException'
>      what():  Algorithm 'Foo' is not supported
>
> Any ideas on what might cause the exception to pass uncaught? I am
> familiar with http://gcc.gnu.org/faq.html#dso.
>
> [SNIP]

Found it.... MessageDigest md1("Foo") uses 'createInstance(...)' in a
PIMPL. However, createInstance(...) [incorrectly] declared it throws a
"InvalidArgumentException". In reality, the function throws a
"NoSuchAlgorithmException".

Visual Studio ran fine because MSVC ignores the exception
specification (http://msdn.microsoft.com/en-us/library/wfa0edys%28v=VS.90%29.aspx).

I'm running with -Wall, -Wextra, which did not help me. Would anyone
know the warning I am looking for? I did not see it at
http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html.

Jeff



More information about the Gcc-help mailing list