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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [ext/] [case-range2.C] - Blame information for rev 821

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

Line No. Rev Author Line
1 693 jeremybenn
// { dg-do compile }
2
// Tests if case ranges (a GNU extension) correctly emit messages
3
// about overlapping ranges.
4
// { dg-options "" }
5
 
6
const int low = -2;
7
const int high = 15;
8
 
9
template 
10
T f2 (T i)
11
{
12
  switch (i)
13
  {
14
    case low ... high : return i + 1;  // { dg-error "previously" }
15
    case 5 : return i + 2;             // { dg-error "duplicate" }
16
    default : return 0;
17
  }
18
}
19
 
20
int f (int i)
21
{
22
  switch (i) {
23
    case 1 ... 10: return i + 1;       // { dg-error "first entry" }
24
    case 3 ... 5 : return i + 3;       // { dg-error "duplicate" }
25
    default: return f2 (i);            // { dg-message "required" }
26
  }
27
}

powered by: WebSVN 2.1.0

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