blob: 9fa81ca0a6d8e681919118dc3f5439d8ae1d16cd [file] [log] [blame]
// checking function-try-block
#include "config.h"
int tried;
int caught;
template <class T>
T foo (T t)
try { // <-- testing
++tried;
throw t;
}
catch (T) {
++caught;
throw;
}
struct S
{
S (int i)
try // <-- testing
: i_ (i) {
++tried;
foo (i_);
}
catch (int) {
++caught;
throw;
}
int i_;
};
int main ()
{
int result = 0;
try {
S s (123);
(void)&s;
result |= 1;
}
catch (int i) {
if (i != 123)
result |= 2;
if (tried != 2)
result |= 4;
if (caught != 2)
result |= 8;
}
catch (...) {
result |= 0x10;
}
return result;
}