OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [cpp0x/] [nullptr21.C] - Blame information for rev 707

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
// { dg-do run }
2
// { dg-options "-std=c++0x" }
3
 
4
// Test throw and catch
5
 
6
#include 
7
 
8
typedef decltype(nullptr) nullptr_t;
9
 
10
int main()
11
{
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" }
27
 
28
  nullptr_t mynull = 0;
29
  try {
30
    throw mynull;
31
  } catch (void*) {
32
    printf("Test 2 Fail");
33
  } catch (bool) {
34
    printf("Test 2 Fail");
35
  } catch (int) {
36
    printf("Test 2 Fail");
37
  } catch (long int) {
38
    printf("Test 2 Fail");
39
  } catch (nullptr_t) {
40
    printf("Test 2 OK");
41
  } catch (...) {
42
    printf("Test 2 Fail");
43
  }  // { dg-output "Test 2 OK" }
44
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.