Add support for C++0x nullptr.
[official-gcc/constexpr.git] / gcc / testsuite / g++.dg / cpp0x / nullptr21.C
blob84c34dd1e0a19c646531301e1bff955eca4d74d5
1 // { dg-do run }
2 // { dg-options "-std=c++0x" }
4 // Test throw and catch
6 #include <cstdio>
8 typedef decltype(nullptr) nullptr_t;
10 int main()
12   try {
13     throw nullptr;
14   } catch (void*) {
15     printf("Test 1 Fail");
16   } catch (bool) {
17     printf("Test 1 Fail");
18   } catch (int) {
19     printf("Test 1 Fail");
20   } catch (long int) {
21     printf("Test 1 Fail");
22   } catch (nullptr_t) {
23     printf("Test 1 OK");
24   } catch (...) {
25     printf("Test 1 Fail");
26   }  // { dg-output "Test 1 OK" }