blob: c30cb3c8b6de0880e5274d399e63f4960cdc32f8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
// { dg-do run }
// { dg-options "-std=c++0x" }
// Test throw and catch
#include <cstdio>
typedef decltype(nullptr) nullptr_t;
int main()
{
try {
throw nullptr;
} catch (void*) {
printf("Test 1 Fail");
} catch (bool) {
printf("Test 1 Fail");
} catch (int) {
printf("Test 1 Fail");
} catch (long int) {
printf("Test 1 Fail");
} catch (nullptr_t) {
printf("Test 1 OK");
} catch (...) {
printf("Test 1 Fail");
} // { dg-output "Test 1 OK" }
nullptr_t mynull = 0;
try {
throw mynull;
} catch (void*) {
printf("Test 2 Fail");
} catch (bool) {
printf("Test 2 Fail");
} catch (int) {
printf("Test 2 Fail");
} catch (long int) {
printf("Test 2 Fail");
} catch (nullptr_t) {
printf("Test 2 OK");
} catch (...) {
printf("Test 2 Fail");
} // { dg-output "Test 2 OK" }
}
|