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

Subversion Repositories openrisc

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

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

Line No. Rev Author Line
1 693 jeremybenn
// { dg-do compile }
2
// { dg-options "-std=c++0x" }
3
enum class Col { red, yellow, green };
4
 
5
int x = Col::red; // { dg-error "cannot convert" }
6
Col y = Col::red;
7
 
8
void f()
9
{
10
  if (y) { } // { dg-error "could not convert" }
11
}
12
 
13
enum direction { left='l', right='r' };
14
void g() {
15
                                // OK
16
  direction d;
17
                                // OK
18
  d = left;
19
                                // OK
20
  d = direction::right;
21
}
22
enum class altitude { high='h', low='l' };
23
void h() {
24
  altitude a;
25
  a = high;                     // { dg-error "not declared in this scope" }
26
  a = altitude::low;
27
}

powered by: WebSVN 2.1.0

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